Computer Science, asked by bholasingh01, 1 year ago

java program is further divided into how many categories​

Answers

Answered by aay11
2

Answer:

1. Static methods: A static method is a method that can be called and executed without creating an object. In general, static methods are used to create instance methods.

Static method can be invoked directly via class name i.e.; we don't have to create an object for a class in order to initiate static method.

You can get more information on static methods here.

2. Instance methods: These methods act upon the instance variables of a class. Instance methods are being invoked with below syntax

<<class-name>>.<<method-name>>;

Instance methods are classified into two types

a. Accessor methods: These are the methods which read the instance variables i.e.; just go access the instance variables data. Generally these methods are named by prefixing with "get".

b. Mutator method: These are the methods, which not only read the instance variables but also modify the data. Generally these methods are named by prefixing with "set".

3. Factory methods: A factory method is a method that returns an object to the class to which it belongs. All factory methods are static methods.

Eg: NumberFormat obj = NumberFormat.getNumberInstance()

Answered by samir4934
18

Java program can be further divided into two types

1. primitive roye

2.reference type

Similar questions