What is wrong with the given snippet of code rewrite it so


1.What is wrong with the following snippet of code? Rewrite it so it produces the correct output.
if (a < b) if (a == c) System.out.println("a < b and a == c");else System.out.println("a is not less than b");

2. Assume numOne and numTwo
are integers. How many times might the following code print out grape? Explain your answer.
if (numOne > numTwo && numOne < numTwo) System.out.println("grape");else { if(numOne == numTwo) { System.out.println("grape"); if(numOne > numTwo) System.out.println("grape"); }//end if numOne == numTwo }//end else

Solution Preview :

Prepared by a verified Expert
JAVA Programming: What is wrong with the given snippet of code rewrite it so
Reference No:- TGS02386330

Now Priced at $15 (50% Discount)

Recommended (98%)

Rated (4.3/5)