Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java call method from another class example

public class method{
  public static void sayHello(){
    System.out.println("Hello World");
  }
}
public class app{
  public static void main(String[] args){
    method m = new method(); // Creating an instance from our class
    m.sayHello(); // using the class methods by the instance we created.
  }
}
 
PREVIOUS NEXT
Tagged: #java #call #method #class
ADD COMMENT
Topic
Name
5+2 =