Answers for "call a method in java"

3

how to call a function in java

public class MyClass {
 
    static void myMethod() {
        System.out.println("You have called me! My name is: myMethod!");
    }
 
    public static void main(String[] args) {
        myMethod();
    }
}
Posted by: Guest on February-24-2021
3

how to call a function in java

public class MyClass {
 
    static void myMethod() {
        System.out.println("You have called me! My name is: myMethod!");
    }
 
    public static void main(String[] args) {
        myMethod();
    }
}
Posted by: Guest on February-24-2021
1

Java method calling

public class Main {
  static void myMethod() {
    System.out.println("I just got executed!");
  }

  public static void main(String[] args) {
    myMethod();
  }
}

// Outputs "I just got executed!"
Posted by: Guest on October-18-2021
1

Java method calling

public class Main {
  static void myMethod() {
    System.out.println("I just got executed!");
  }

  public static void main(String[] args) {
    myMethod();
  }
}

// Outputs "I just got executed!"
Posted by: Guest on October-18-2021
1

method/function in java

public class Main {
  static void myMethod() {
    // code to be executed
  }
}
Posted by: Guest on July-04-2021
1

method/function in java

public class Main {
  static void myMethod() {
    // code to be executed
  }
}
Posted by: Guest on July-04-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language