@@ -9,12 +9,12 @@ class Vehicle
99{
1010 private  String  color ;
1111
12- /** 
12+ /**********************************************************************  
1313Constructor 
1414A constructor can be used to provide initial values for object attributes. 
1515- A constructor name must be same as its class name. 
1616- A constructor must have no explicit return type. 
17- */ 
17+ ************************************************************************ / 
1818Vehicle ()
1919{
2020color  = "Red" ;
@@ -23,10 +23,10 @@ class Vehicle
2323{
2424this .setColor (c );
2525}
26- /** 
26+ /***********************************************************************************  
2727Java automatically provides a default constructor, so all classes have a constructor,  
2828whether one is specifically defined or not. 
29- */ 
29+ ************************************************************************************* / 
3030
3131 // Getter 
3232 public  String  getColor ()
@@ -39,33 +39,33 @@ public void setColor(String c)
3939{
4040 this .color  = c ;
4141 }
42- /** 
42+ /*********************************************************************  
4343Getters and setters are fundamental building blocks for encapsulation, 
44- */ 
44+ ********************************************************************** / 
4545}
4646class  H_Objects  
4747{
4848 public  static  void  main (String [ ] args )
4949{
5050 Animal  dog  = new  Animal ();
5151 dog .bark ();
52- /** 
52+ /***********************************************************************  
5353Now, dog is an object of type Animal. Thus we can call its bark() method,  
5454using the name of the object and a dot. The dot notation is used to access  
5555the object's attributes and methods. 
56- */ 
56+ ************************************************************************ / 
5757Vehicle  v1  = new  Vehicle ();
5858 v1 .setColor ("Green" );
5959 System .out .println (v1 .getColor ());
6060Vehicle  v2  = new  Vehicle ("Blue" );
6161System .out .println (v2 .getColor ());
6262 }
6363}
64- /** 
64+ /**********************************************************************************  
6565default: A variable or method declared with no access control modifier is available  
6666to any other class in the same package. 
6767public: Accessible from any other class. 
6868protected: Provides the same access as the default access modifier, with the addition  
6969that subclasses can access protected methods and variables of the superclass  
7070private: Accessible only within the declared class itself. 
71- */ 
71+ *********************************************************************************** / 
0 commit comments