Question: I need help fixing this code. Please provide the correct code by changing the syntax errors. Here is the exercise: Fix the code in Oops1.java.

I need help fixing this code. Please provide the correct code by changing the syntax errors. Here is the exercise:

Fix the code in Oops1.java. There are at least 7 different syntax mistakes. You do not need to rewrite the logic, the errors are only syntax errors. Here is the code:

//This program will display the smaller of the two //numbers a and b. Assume that a and b will never be //equal.

import java.util.Scanner;

public class Oops1 { public static void main(String[] args) { int a = 7; b = 42; //declaration of local variables. minimum(int a,int b); //call method to find the min. of a and b. if (smaller = a) // this branch is taken if a is < b. System.out.println("a is the smallest!"); else System.out.println("b is the smallest!");

}

public static void minimum(int a, int b){ if (a < b){ int smaller = a; }else (a => b) { int smaller = b; } //return the variable smaller, which should contain the smaller of a & b. return int smaller; } }

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!