Though this question was answered by definition here: Difference between a method and a function, I am posing the question with examples to clarify my understanding.
Please read the comments for each call in First.class and let me know if I've grasped the difference between a function and a method.
First.class
public class First {
public static void main(String[] args){
String a = "2";
Second.myMethod(a); // calling METHOD myMethod() from class Second.class and passing parameter of object `a`
Integer.parseInt(a); // calling METHOD parseInt() from class Integer.class and passing parameter of object `a`
a.length(); // calling FUNCTION length() for object 'a'.
}
}
Second.class
public class Second{
public static void myMethod(String n){
System.out.println(n);
}
}