Can someone tell me how I would I call a Function in Java?
Printable View
Can someone tell me how I would I call a Function in Java?
For a non-static method you would need a handle to an object. For a static method you can just make the call via the class name.
Code:public class X{
public static void main(String[] args){
String s = String.valueOf(525); static call
System.out.println(s);
String s2 = s.substring(0,2); // non-static call
System.out.println(s2);
}
}