CH4 – Multiple Parameters

  1. Create a new class named MultipleParameters.
  2. Add the following method to the class.
public class MultipleParameters {
  public static void printTime(int hour, int minute){
    System.out.print(hour);
    System.out.print(":");
    System.out.println(minute);
  }
}
  1. Add main to the class and have the method call printTime.
public class MultipleParameters {
  public static void printTime(int hour, int minute){
    System.out.print(hour);
    System.out.print(":");
    System.out.println(minute);
  }
  public static void main(String[] args){
    MultipleParameters.printTime(12,22);
  }
}
  1. Compile and run the program.
$ javac MultipleParameters.java
$ java MultipleParameters
12:22