Wednesday, 29 January 2014

Class in Java.

     A class Is a more inporant  concept in java langauge such this is more important part.we will define the method, variable and property then belongs to class.in class we will define a variable,method and declare them properly to the structure of class we will define class defination,syntax and Example of class In simple langauge.

Class :  A class Is a collection Of  Set Of  Method And Property.

Syntax:   Class class Name
               {
                          // Body Of a class;
               };

Example :

                  class Student
                  {
                               int id;
                               char Name;
                   };



More about Classes

  1. Class name must start with an uppercase letter. If class name is made of more than one word, then first letter of each word must be in uppercase.
  2. Classes contain, data members and member functions, and the access of these data members and variable depends on the access specifiers.
  3. Class's member functions can be defined inside the class definition or outside the class definition.
  4. Class in C++ are similar to structures in C, the only difference being, class defaults to private access control, where as structure defaults to public.
  5. All the features of OOPS, revolve around classes in C++. Inheritance, Encapsulation, Abstraction etc.
  6. Objects of class holds separate copies of data members. We can create as many objects of a class as we need.
  7. Classes do posses more characteristics, like we can create abstract classes, immutable classes.

0 comments:

Post a Comment