Monday, 20 January 2014

Using object in java


As you know, a class provides the blueprint for objects; you create an object from a class.A typical Java program creates many objects, which as you know, interact by invoking methods. Through these object interactions, a program can carry out various tasks, such as implementing a GUI, running an animation, or sending and receiving information over a network. Once an object has completed the work for which it was created, its resources are recycled for use by other objects.

Sunday, 19 January 2014

INTRODUCING METHODS

In java,there are some fundamentals that you need to learn now so that you can begin to add methods to your classes.Although it is perfectly fine to create a class that contains only data,it rarely happens.Most of the time you will use methods to access the instance variables defined by the class.

DIFFERENT TYPE OF VARIABLES IN JAVA

A class can contain any of the following variable types.
                           1.Local Variables
                           2.Instance variables
                           3.Class variables

FUNDAMENTAL CLASS PATTERNS IN JAVA

A class the basic building block of an object-oriented language such as Java is a template that describes the data and behavior associated with instances of that class. The data associated with a class or object is stored in variables; the behavior associated with a class or object is implemented with methods.

Friday, 17 January 2014

JUMP STATEMENTS OR BRANCHING STATEMENTS:return

Using return statement


return:


The return statement is used to explicitly return from a method. The return statement is used to explicitly return from the method . That is, that is it causes program control to transfer back to the caller of the method.

JUMP STATEMENTS OR BRANCHING STATEMENTS:continue


Using continue statement


continue:


 statement in java used to skip the part of the loop.Sometimes it is useful to force an early iteration of a loop.Unlike break statement it does not terminate the loop,instead it skip the remaining part of the loop and the control again goes to check the condition again.Continue statement can be used only loop control statements,

Thursday, 16 January 2014

Iteration statements : do-while

How to use java do-while:Exit control loop

Using do-while

A do-while is similar to while loop,except that a do-while loop is quaranteed to execute atleast one time. For that you have to use the do while loop in  after that check the condition then we use the do-while loop statement. do-while loop is same as the while loop statement but while loop checks the certain condition is first and if condition is true then statements or processes are executed otherwise all the statements written under the while loop is ignored by the interpreter