Java Advance

Working with Methods and Encapsulation

views

10:33
So far we have seen the use of class to encapsulate the “main” method. In Java, it is very important to realize that the classes in Java define a new data type. The reason behind this is that if you define a class, then it can be used to create an object. It is well known fact that a class defined in Java serves as a template for a n object. And the object is an instance of a class. So let us understand the structure of the class. The class in Java is declared with the keyword “class”.