Answers for "call a method of another class in java"

3

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.
  }
}
Posted by: Guest on June-18-2021
-2

how to access methods from another class in java

public class Alpha {
     public void DoSomethingAlpha() {
          Beta cbeta = new Beta();
          cbeta.DoSomethingBeta();  //?
     }
}
Posted by: Guest on December-22-2020

Code answers related to "call a method of another class in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language