I want to know, what is the use of the non-static method. My understanding is that static methods can be called directly as well as by the object of the class while nonstatic methods can only be called by an object of the class.
class Ideone
{
public static void print()
{
System.out.println("print");
}
public static void main (String[] args) throws java.lang.Exception
{
Ideone id = new Ideone();
id.print();
print();
}
}
The above method can be called directly as well as by an object of class. So, when should I have a non static method?