Ads Sponsored By Google :)

Saturday 12 January 2013

what is definition of class|member methods and non member methods in java with example


what is class in java class in java definition of class in java with example class in java with example member methods and non member methods of class in java


             Class:

                       It is one of the distinct principle in Object Oriented Programming language Or OOP's 
               principles.By using  class concept is always used for developing user / programmer /               
              custom defined data types.
  Each and every java program must start with concept of class.

     Definition:
                   The process of binding data members and associated methods as single unit is 
          known as Class.
                                                                Or
         The collection of data members and methods is known as Class.

     Syntax:
  
           Class  <classname>
         {
            Variable declaration;
            Method definition;
         }





        Class demo1
    {
        int x,y; // data members or class variables
        float a,b;// data members or class variables
        int m1()// data methods
      {
         --------
        Return(3);
      }       
       float m2()// data methods
     {
       --------
       Return(8.9);
     }
   }; //End of Class

   End of the class by using ; or semicolon  is optionally.

 Note :  When we define class ,there is no memory space is created for data members and associated   methods.

Creation of memory for data members in class when object is created.
We discuss it in briefly in Object


Member methods /non member methods Of class in java

  In Object oriented programming language we have two types of methods they are
  
 a)      Member Methods
 b)      Non-Menmber methods
         
       a)      Member Methods:
    
    The member methods is one which are available with in the scope of class and they can access data members of class.

       b)     Non-Member Methods:

    The Non-Member methods is one which is not available with in the scope of the class and they cannot access data members of class.
Hence java programming concept supports only the concept of member method but the concept of non-member methods.




Object Oriented Programming Principles Are :






No comments:

Post a Comment

LinkWithin