- 1

Output of program:

public class pq{ static boolean a; static boolean b; static boolean c; public static void main(String[] args) { boolean bool = (a = true) ||(b = true) && (c = true); System.out.print (a +"," + b + ","+ c); } }

23rd Mar 2018, 5:50 PM
Vartika Pahuja
Vartika Pahuja - avatar
4 ответов
+ 2
No, java will calculate only (a = true) because after there is operator ‘or’, and other parts wouldn’t be calculated. b, c = false because of default values.
23rd Mar 2018, 6:19 PM
solntsa
solntsa - avatar
+ 1
Hmm, what is it? 😒 You want output? Then: true, false, false.
23rd Mar 2018, 6:11 PM
solntsa
solntsa - avatar
0
it's short circuit evaluation..only a=true is calculated. b and c have default values which are false!! output is true false false
24th Mar 2018, 4:59 AM
Saketh Mattupalli
- 3
"true,true,true" /*quotes indicates type of String. */
23rd Mar 2018, 6:13 PM
josh mizzi
josh mizzi - avatar