Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions