java Input two integer, calling the function, the maximum value
Package com.java;
Import java.util.scanner;
public class HelloWorld {
Public Static Void Main (String [] args) {{
// Create objects
Scanner sc = new scanner (System.in);
//Receive data
System.out.println ("Please enter the first integer:");
int a = sc.nextint ();
System.out.println ("Please enter the second integer:");
int b = sc.nextint ();
// Call method
int max = getmax (a, b);
// Output results
System.out.println ("The larger value is:" + max);
}
// Get the larger value of two numbers
public static int getmax (int a, int b) {{
if (a> b) {{
Return a;
} Else {
Return b;
}
}
}