This topic contains a solution. Click here to go to the answer

Author Question: Suppose isPrime is a boolean variable, which of the following is the correct and best statement for ... (Read 357 times)

washai

  • Hero Member
  • *****
  • Posts: 523

Question 1

Analyze the following code:

boolean even = false;
if (even = true) {
System.out.println("It is even!");
}

◦ The program runs fine and displays It is even!
◦ The program has a runtime error.
◦ The program has a compile error.
◦ The program runs fine, but displays nothing.

Question 2

Suppose isPrime is a boolean variable, which of the following is the correct and best statement for testing if isPrime is true?
◦ if (isPrime = true)
◦ if (isPrime)
◦ if (!isPrime = false)
◦ if (isPrime == true)
◦ if (!isPrime == false)


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by washai on May 6, 2020

chereeb

  • Sr. Member
  • ****
  • Posts: 326
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 50% of students answer this correctly




 

Did you know?

More than 2,500 barbiturates have been synthesized. At the height of their popularity, about 50 were marketed for human use.

Did you know?

The liver is the only organ that has the ability to regenerate itself after certain types of damage. As much as 25% of the liver can be removed, and it will still regenerate back to its original shape and size. However, the liver cannot regenerate after severe damage caused by alcohol.

Did you know?

Malaria was not eliminated in the United States until 1951. The term eliminated means that no new cases arise in a country for 3 years.

Did you know?

The ratio of hydrogen atoms to oxygen in water (H2O) is 2:1.

Did you know?

The most dangerous mercury compound, dimethyl mercury, is so toxic that even a few microliters spilled on the skin can cause death. Mercury has been shown to accumulate in higher amounts in the following types of fish than other types: swordfish, shark, mackerel, tilefish, crab, and tuna.

For a complete list of videos, visit our video library