We can define any number of methods in the class as long as required. We can perform the actions on the data members in a class. The methods can also access the data members defined in the class. We can perform anything which is the requirement in methods.The methods are an easy way to combine and perform the specific actions which are required while programming. While programming in Java, we will normally create an object and assign values to its data members and perform specific actions related to it using the methods.Calling action is nothing but the behavior of the mobile. For example, the mobile will perform the action of calling or dialing. The methods are like behavior in the real world. The methods represent a specific action or process to be performed when called using the object reference. The methods are again specific to the class in which they are declared. These methods are nothing but are like the functions which are declared in a class. The second main thing which we declare while creating a class is methods.The different memory locations will be allocated for every property related to the object we create. For example, an object of Mobile may have a property like size, weight, etc. As the object resembles a real-time entity, properties represent the state of an entity. We can access these properties in the class or outside by using the object reference depending upon the modifier used for it. ![]() Every object, when created in java, it will have these properties available with it. The properties are nothing but the specific data which is related to the class. This is known as the properties of an object. The first represents the attribute or state. When defining a class in Java, we define the main two things. The state will define attributes, and behavior will define the actions related to the class. These things are declared in class itself.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |