A non-static method is always accessed using the object of class as shown in the above example.
Notes:
How to call static methods: direct or using class name:
StaticDemo.copyArg(s1, s2);
OR copyArg(s1, s2);
How to call a non-static method: using object of the class:
JavaExample obj = new JavaExample();
Important Points:
Static Methods can access static variables without any objects, however non-static methods and non-static variables can only be accessed using objects.
Static methods can be accessed directly in static and non-static methods. For example the static public static void main() method can access the other static methods directly. Also a non-static regular method can access static methods directly.