- Create a new class named MultipleParameters.
- 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); } }
- 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); } }
- Compile and run the program.
$ javac MultipleParameters.java $ java MultipleParameters 12:22