So far, we have studied many basic features of Java. We know that Java is a highly object-oriented language. The study of this aspect of the language starts with the concept of class. Let us study classes step by step in this chapter.
Class can be considered as nothing but a user-defined type. It is a template for the object to be created. It holds some data. This data can be of different simple types we have studied earlier.
Let us take an example of time. It consists of hours, minutes, and seconds. To store these quantities, we need three different fields (variables). But together they constitute a single object.
A class in general has two types of members. ...