0
Why we are using "&" And "!b" In the printing line what's it used for?
public class Main { public static void main(String[] args) { int a=100; boolean b=false; System.out.println(++a>100&!b); } }
4 Respostas
+ 1
Karthik Reddy Thotamgari
& Operator behaves same like as && operator but it evaluate all conditions even they are false
! operator is called unary operator that takes a Boolean value as its operand so here
++a = 101
And
!b = !false = true
So finally (101 > 100 & true) = true
+ 1
https://www.sololearn.com/Discuss/2762647/?ref=app
// Explanation given here
+ 1
About !b
0
Atul ik abt that but the logic here is bit confusing ... Yea it's clear now