Wednesday, June 10, 2009

Java Important Terms, Definations and Concepts

Features of Java

--------------------------------


1) Encapsulation--> This means grouping of data members and member functions into single unit called class. This also means grouping of related entities into single unit. For ex grouping of classes, interfaces and subpackages into single package.

************************************************

2)Polymorphism-->This means one interface many forms.We can also so existing in many forms. This can be of two type:


a) Static Polymorphism--> This means specifying things at compile type. For example method overloading. We specify at compile time by passing arguments that which method to be called.


b)Dynamic Polymorphism--> This means specifying things at runtime. For example method overriding. Say for ex: a super class variable can have object of super class or any of its sub classes. If we call an overriden method, then its the method of the class whose object is referred by super class variable at runtime.

***************************************

3)Inheritance--> It is the fundamental mechanism of creating a new class from an existing one. This way new class has properties of base class as well as new class. This is called is-a relation. This should be used where is-a relation is maintained throughout the lifecycle of the objects involved.

******************************************


4)Aggregation-->This means creating a new class using existing class as datamember of the new class. This is called has-a relation.


******************************************


5)Class--> A class is a blueprint or category of objects. A class specifies properties and behaviour of a an object. The properties of a class are called attributes and defined by fields in Java. The behaviour of a class is operations and defined by methods in Java. They both collectively are called members.


******************************************


6)Object--> It is an instance of a class. It is constructed using blueprint of the class.


******************************************


7)Object References--> Its same as object variable.


******************************************


8)Static Members--> Static members belong to the class and not to a particular object.


******************************************


9)Instance Members--> They belong to a particular object.Each object has its own copy of instance  member.


******************************************


10) Static block--> This is the block contained in a class and is executed each time class is loaded. That is its called even if a class contains no main method and we execute the class.It is generally used to initialize static members.


*******************************************


11)Non Static Block--> It is called each time an object of a class is created. If static, non-static and constructor are there in the class, then they are executed in following order: static blok-->non-static block--> constructor.


*****************************************


There are two ways of defining a new class from an existing class, inheritance and aggregation.






Inheritance-->This means defining a new class from an existing one, which contains its own properties, apart of properties from a base class. Its an "is a relation" in uml notation.






Aggregation-->In this approach a new class is constructed using objects from other classes as constituent or members of this class.


****************************************


12)Lexical tokens--> The low-level language elements are called lexical tokens and are used to construct more complex language constructs. identifiers, numbers, operators and special characters are called lexical tokens.


*****************************************
13)Keywords--> Keywords are reserved identifiers in a language and cannot be used to denote other entities.


******************************************


14) Literal--> It denotes a constant value.


String Literal example>"Hello","world"


*******************************************


Primitive Datatypes and Literal Examples:


Integer Literal example-> 2,3


Floating Point Literal example-> 2.45,3.15


Boolean Literal example--> true, false


Character literal example-->'a','2','\u002'(four digit hexadecimal number from \u0000 to \uffff), '\121'(octal number from \0 to \377)


Long Literal example-->10l,20l


double literal example-->3.21d,5.54d


octal literal example-->012,07


Hexadecimal literal example-->0x1b,0x10

Thats all for the day !!!!

*********************************************

Search Amazon for Best Books on Java J2EE

Blogarama

blogarama - the blog directory

Search your favourite topics

Google