Java4teachus

Saturday, August 18, 2018

Definition Of Class in Java

Purpose Of a Class

In previous post we already learnt about the OOPS Principles. Now  we discuss about on the first concept in oops principle called as "class".
  • The purpose of class concept  is used to  develop the  programmer defined data type and also to develop the  "REAL WORLD APPLICATIONS".
  • Each and every java program must be start with concept of class. Without class concept there is no java program.
  • The purpose of developing programmer defined data type is that to store "Multiple value of same " or " different type or both the types " .
  • To develop programmer defined data type with class concept, we use the keyword called "class".
  • Programatically each & every class name is treated as "programmer defined data type".

Definition :-

"A class is a collection of data member & method" is known as class.
                                                 (or)
"The process of  binding the data  members and associate methods in a single unit " is called class .
  • In java we must have  to define a class keyword. Because the memory space is not created for the Data Members and Methods. But whose memory space is created only when we create an object with respect to corresponding "class name" .
  • Data member of a class are also known as "Attributes (or) Fields (or) Properties ". Where as "Methods" are also called as "Behavior (Or) Accessories".
  • Programatically data members and methods are associated with in a class. But  without class name the memory space and  available as it is with object along with memory space.
In real world the definition of class expressed by class diagrams in the helps of xml software like rational rows, turbos annalist (IBM pro). Structure of a class diagram is shown below. 

Structure Of a  Class :-

Structure-Of-A-Class-in-Java.png
                                     
Q . Draw a class diagram  or storing student information ?

Diagram-of-a-class.png

Class : Class is a collection of Data Members where members can be members variables or members functions. Classes are used to prepare ADTs. In the above example, "Student" is the class.

Properties : The members of a class are called Properties Or Attributes . These are also called as "Data Members" . In the above diagram 'Number, Name, Marks' are properties.

Methods : The member function of a class can be called as "Methods". In the above diagram getNoOfHoursStudy(), getTotolMArks(), getGrade() are the methods or behavior. 

No comments:

Post a Comment

Thanks for visiting my site..