Question: Given code in Java: import java.util.Scanner; public class MaxOfTwo { /* Type your code here. */ public static void main(String args[]) { MaxOfTwo maxObject =

 Given code in Java: import java.util.Scanner; public class MaxOfTwo { /*

Given code in Java:

import java.util.Scanner;

public class MaxOfTwo { /* Type your code here. */ public static void main(String args[]) { MaxOfTwo maxObject = new MaxOfTwo(); Scanner scnr = new Scanner(System.in); int num1; int num2; int max; num1 = scnr.nextInt(); num2 = scnr.nextInt(); max = maxObject.findMax(num1, num2); System.out.println("Max: " + max); } }

Write a method, findMax(), that takes in two integers and returns the largest value. Ex: If the program input is: 4 2 the method find Max() returns: 4 Note: Your program must define the method: public int findMax(int num], int num2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!