Write the definition of a method printLarger, which has two int parameters and returns nothing. The method prints the larger value of the two parameters to standard output on a single line by itself.

2
Write the definition of a method printLarger, which has two int parameters and returns nothing. The method prints the larger value of the two parameters to standard output on a single line by itself.

LANGUAGE: JAVA

CHALLENGE:

Write the definition of a method printLarger, which has two int parameters and returns nothing. The method prints the larger value of the two parameters to standard output on a single line by itself.

SOLUTION:

public void printLarger (int aint, int bint){
   System.out.println(Math.max(aint, bint));
}

2 comments

Add comment