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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.