Sunday, July 22, 2012

DATA TYPES IN JAVA



  • Data Types in Java:

Every variable in java has a data type. Data types specify the size and type of values that can be stored. Java language is rich in its data types. The varieties of data types available allow the programmer to select the type appropriate to the needs of the application. Data types in Java under various categories are shown in figure below.

  • Size and Range:

    Type
Size
Minimum Value
Maximum Value
Byte
One byte
-128
127
Short
Two bytes
-32,768
32,767
int
Four bytes
-2,147,483,648
2,147,483,647
long
Eight bytes
-9,223,372,036,854,775,808
9,223,372,036,854,775,807
float
Four bytes
3.4e-038
1.7e+0.38
double
Eight bytes
3.4e-038
1.7e+308

Sunday, July 15, 2012

Object-Oriented Paradigm


  • What is Object Oriented Paradigm?
                The major objective of object-oriented approach is to eliminate some of the flaws encountered in the procedural approach. OOP treats data as a critical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the functions that operate on it and protects it from unidirectional modification by other functions.
  • What is Objects?
OOP allows us to decompose a problem into a number of entities called Objects and the build data and functions around these entities. The combination of data and methods make up an Object.
The data of an object can be accessed only by the methods associated with that object. However methods of one object can access the methods of other objects.
  • Features of Object Oriented Paradigm:
·         Programs are divided into what are known as Objects.
·         Methods that operate on the data of an object are tied together in the data structure.
·         Data is hidden and cannot be accessed by the external functions
·         Object may communicate with each other through methods.
  • Definition of Object Oriented Paradigm:
Object Oriented Programming is an approach that provides a way of modularizing programs by creating partitioned memory area for both data and functions that can be used as templates for creating copies of such modules on demand.

  • Benefits of Object Oriented Paradigm:

OOP offers several benefits to both the program designer & the user. Object-orientation contributes to the solution of many problems associated with the development and quality of software products. The new technology promises greater programmer productivity, better quality of software and less maintenance cost.

  1. Through inheritance, we can eliminate redundant code and extend the use of existing classes.
  2. The principle of Data Hiding helps the programmer to build secure programs that can not be invaded by code in other parts of the program.
  3. Software Complexity can be easily managed.
  4. It is possible to map objects in the problem domain to those objects in the program.