Java
Programming and Technical
Programming
Technical
What are the types of methods in java
Read Solution (Total 3)
-
- 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.
Instance methods: These methods act upon the instance variables of a class. Instance methods are being invoked with below syntax
.;
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".
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();
- 9 years agoHelpfull: Yes(4) No(1)
- instance methods
static mathods - 9 years agoHelpfull: Yes(1) No(0)
- instance methods
class methods(static methods) - 9 years agoHelpfull: Yes(0) No(0)
Java Other Question