hello Uday
****Static Method****
Static methods can be used without instantiating a new instance of the class.
public class Utils {
public static String getHelloWorld() {
return ‘Hello World’;
}
}
These methods can be called directly
String salutation = Utils.getHelloWorld();
****Non-Static Method****
Non-static method must have a new instance of the class instantiated in order to be used. Typically these rely on data inside the class that then is referred to inside the class
public class Utils {
public String getHelloWorld() {
return ‘Hola Mundo’;
}
This version of the method requires us to create a new instance
Utils a = new Utils();
String require =a.getHelloWorld();