CLASS and OBJECT.

Lets assume we want to purchase a mobile , humney ek paper liya  aur uspey humney apni requirements likhi

Like,

  1. Feature humko chahiyey (16mp camera , 4gb Ram ..etc)
  2. Kitana budget hai hamara
  3. Kaunsa brand favourable hai

 Now , hum market mein gayey and humney shopkeeper ko ye paper diya

What he will do ?

 

Think ……………….. (to the students : write this on paper.)

 Answer :

So he will basically see ki kitaney mobile apki requirement ko fulfil kartey hai ,  uskey according who apko sarey mobile dikhayega …. (agreed ?).

 

If you can understand this ,

 Then ,

 Jo paper pe apkey specification they , and jo blueprint they jiskey according apko phone chahiyey tha usey hum …….. CLASS kehtey hai

 And

 Jo different mobile apko shop keeper ne dikhaya who sab us specification ko follow karney waley OBJECTS hai.

 

 In java ,

 

Class  ko hum aisey define kartey hai ,

 

public class MobileSpecification {

 

    String feature ;

    Integer budget = 500 ;

    String brand;

}

 

Aur Object ko hum aisey define kartey hai ,

 

MobileSpecification mobileSpecification = new MobileSpecification()