Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Based on the following code what will be the output? * A. value1 is false * B. v

ID: 3915595 • Letter: B

Question

Based on the following code what will be the output? * A. value1 is false * B. value1 is true value2 is false * C. value1 is true value2 is true. * --------------------------------------------------------------------------------------------------------- * boolean value1 = true, value2 = false; if(value1 == true){ System.out.println("value1 is: " + value1); if(value2 = true){ System.out.println("value2 is: " + value2); } else{ System.out.println("value2 is: " + value1); } } else{ System.out.println("value1 is: " + value1); }

Explanation / Answer

If you have any doubts, please give me comemnt...

Ans: C)

value1 is true

value2 is true

if(value2 = true) //here we assigned true to value2, so value2 also true

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote