Thursday, February 7, 2013

What is Object?



Object is REAL WORLD ENTITY.


Objects have states and behaviors

EXAMPLE :

Consider a bike as OBJECT.

It has
          1)COLOR(as green,red,black) ,NAME of bike
                         This is called as STATE(we are using it as variables)

          2)Ride()
                         This is consider as BEHAVIORS(we are using it in our program as method)



Wednesday, February 6, 2013

What is Class ?



CLASS:

A class is a blue print from which individual objects are created

SYNTAX:

     class classname
    {
        Member variables; //as many as you want
        Methods;//as many as you want
     };
      
EXAMPLE:

class Student
{
          int sNo;
         String studName;
  
          void getStudent() //METHOD
          {
           sNo=1;
           sName="Java";
           }

          void getStudent() //METHOD
          {
           sNo=1;
           sName="Java";
           }

}

A class can have any number of methods to access the value of various kind of methods.