Java: Static Methods and Instance Methods

Static Methods

They are class methods. They are not associated with a particular object. Simply put, you don’t have to declare a new object based on a class to use this method.


String t = String.valueOf(n);

Instance Methods

This operates on an object (an instance of a class). They utilize the instance variables of that object. Simply put, you need to create a new object to make use of this kind of method.


String s = new String("Coding is an awesome career!");
int n = s.length();

Further reading:



August 29, 2014

Posted In: Information Technology

Tags: , ,

Leave a Comment