1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
expeople1 [14]
3 years ago
11

Find and fix the error in the if-else statement. import java.util.Scanner;

Computers and Technology
2 answers:
salantis [7]3 years ago
3 0

Answer:

Hi there Rumanruxi! The error is in the if statement "if(userNum = 2)".

Explanation:

The if statement in this Java code is assigning userNum the value of 2 instead of comparing it with the value of 2. For equals comparison we need to write two equals "==" in the statement as: "if (userNum == 2)". This will return true if userNum is 2 otherwise it will return false.  

andriy [413]3 years ago
3 0

Answer:

The error generated when the code is compiled:

incompatible types: int cannot be converted to boolean

Explanation:

This error is generated because the variable userNum is being assigned the value of 2.

userNum= 2

here = is the assignment operator used to assign the value 2 to the variable userNum

But here we need to compare the values with the value 2. So in order to compare the values in IF statement, == is used which is called the equality operator, instead of =

So the corrected if statement is:

if(userNum==2)

So the program prompts the user to enter a value (0,1,2,3) which is read in the userNum. Next the if statement checks if that input value is equal to 2. Num is equal to two message is displayed in the output when the if condition evaluates to true and Else part is executed if the condition evaluates to false and Num is not two message is displayed in the output.

For example the user enters a value 1 then the following message will be displayed in the output:

Num is not two

If the user enters 2 then the following message will be displayed in the output:

Num is equal to two

You might be interested in
Using features on demand results in saving potentially significant amounts of disk space. features on demand becomes a third ins
larisa86 [58]
The answer is <span>Disabled with payload removed
The development is extremely crucial in the age where we contstantly receive access to overload of content.
Large hardisk means that we could store much more of the amount of data that we could put without compromising the performance.</span>
5 0
3 years ago
1. Keisha is in her first semester of college and is taking 10 credit hours: ACA 122, CIS 110, PSY 150, and developmental math.
serious [3.7K]

The advice is that she should not give up and that she should relax, and think of the time she comprehend more and then start to read. Another is to hire a private tutor to help or put her through.

<h3>What does a private tutor do?</h3>

A private tutor is known to be a person who is a specialist that has been trained in helping students known more and take in the concepts and details of any given course work.

Therefore, The advice is that she should not give up and that she should relax, and think of the time she comprehend more and then start to read. Another is to hire a private tutor to help or put her through and she will pass her exams in flying colors.

Learn more about private tutor from

brainly.com/question/6950210

#SPJ1

7 0
1 year ago
Determine which program you would recommend each of the customers should use. There are multiple correct answers so please inclu
Lana71 [14]
  1. Since Adult A has been asked to create a website for their church, the most appropriate software to use is Sublime Text because it can be used to type all of the instructions to be executed.
  2. Adult B should use Adobe Photoshop to create a flyer about an upcoming social gathering for her workplace.

<h3>What is a text editor? </h3>

In Computer technology, a text editor can be defined as a tool which is typically designed and developed to enable a software or web developer in typing and create the instructions to be used in a software or website such as a blog.

Sublime Text is a very good example of a text editor and should be used by Adult A to create a website for his or her church because it can be used to type all of the instructions that need to be executed and provides indentation by default.

On the other hand (conversely), Adult B should use Adobe Photoshop to create a flyer about an upcoming social gathering for her workplace because it is arguably the best graphics design software.

Read more on text editor here: brainly.com/question/4004088

#SPJ1

5 0
1 year ago
The master system database stores a database template that is used as a blueprint when creating a new user database.
Novay_Z [31]
<span>An attribute in a relation of a database that serves as the primary key of another relation in the same database is called a</span>
6 0
2 years ago
You are trying to troubleshoot a desktop power supply issue using a voltmeter. Which of the following options are the MOST commo
vredina [299]

Answer:

The correct answers are: (A) +/- 5V and (B) +/- 12V

Explanation:

First at all, the purpose of the power supply is transforming from AC (Alternating Current) to DC (Direct Current) for use this energy in chips and electronics devices that consume this type of power. Usually the most common DC voltage for electronics is 5V but in your CPU you also have other devices that might going to need more voltage like fan or hard drives thats ´s why 12V is an also an option. Now some other devices are going to need negative sources such -5V or -12V as well.

7 0
2 years ago
Other questions:
  • Only the _________ can add users with passwords and limit user access to selected areas.
    5·1 answer
  • If you delete an imessage does the other person see it
    12·1 answer
  • If num is an int which expression always evaluates to true if num holds an odd number
    14·1 answer
  • Wireless attacks avoid the access points to limit detection. <br> a. True <br> b. False
    9·1 answer
  • Tasks:_______.
    7·1 answer
  • Why do you classify computers?
    6·1 answer
  • (I need help also can u guys just give me some example just in case I got confuse)
    13·1 answer
  • Which sentence in the passage shows an effective way to protect your document from misuse? Claire has saved her research paper o
    14·1 answer
  • When copper wires are bundled together, they are susceptible to ____________, a form of interference where the signals leak out
    13·1 answer
  • Write an answer in three to five sentences that describes the photo, explains what better lighting would mean for your photograp
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!