Friday, 25 May 2012

Class

A class is a prescription for a particular kind of object.We can use the class definitions to create objects of that class type.Class is also an example of encapsulation because it include that feature.This is to create objects of that class type.That include all the component specified belonging to the class.
The thing's that we can include in our class definition are fields(variables),methods.



Similarly a class is a collection of entities that have similar characteristics or we can say that a class provides definition for an object.

      class Demo
         {
           int demo1;
           int demo2;
          void DemoMethod(int dm1,int dm2)
               {
                 demo1=dm1;
                 demo2=dm2;
                }
           void DemoShow()
               {
                 System.Out.println("Demo1:"+demo1"Demo2:"+demo2);
                }
            }


In this example Demo is name of a class and demo1,demo2 are variables and the DemoMethod, DemoShow are methods of Demo class.

1 comment:

  1. thanks for sharing it. enjoy your stay at javacoderpoint....

    ReplyDelete