0% found this document useful (0 votes)
4 views

Java Programming

Uploaded by

jr.muvea
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Java Programming

Uploaded by

jr.muvea
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

 Classs a group of object that share common properties

 Data abstraction..the act of representing essential without including


background detail or explanations
 Data encapsulation, the wrapping of data and functions into a single
unit
 Inheritance the process by which objects of one class acquire the
properties of another class
 Polymorphism the ability to take more than one form
 Message passing, a set of object communicate with each other.

Java
It is a high level programming language .it can also be referred to as a
platform.

Features of java
 It is an object orientated language
 It is simple
 Secure
 Portable
 Dynamic -able to adopt to evolving environment.

Java virtual machine


It is an abstract machine that provide runtime environment in which
java bit code can be executed

A class

Class class name

type instance variable1...

type methodname(parameter)

// body of function }

}
Class sample

Int length, float height ;

Void ()

// body }

JAVA identifiers

All identifiers should begin with a letter, 💲 or an underscore

After the first character it can have any combination of characters.

A key word cannot be used as an identifier. Any word that has a meaning in
java

It’s case sensitive

Java modifiers

Access modifier or non-access modifiers.

Access modifiers- private, public, default, protected.

 Private, can only be accessed within the declared class.


 Protected, can be accessed
 Default, can be accessed in the same package

Non access modifiers

 Final
 Abstract
Final, the class cannot be inherited .final attributes and methods
cannot be modified
Abstract, the class cannot be used to create object. Abstract methods
do not have a bonding.

DATA TYPES

1. PrimitI’ve
2. Non primitive
Primitive has

byte, stores whole numbers from 128 to 127..1byte

Float stores decimals, 6 to 7 digits...4 bytes

Short ,whole numbers from 32768 to 32 767..2 bytes


Int ,...4 bytes
Long, 8 bytes
Boolean, stores true or false values 1 bit
Double ,stores fractional numbers

You might also like