161k views
2 votes
JAVA

What will be the result of the following two expressions
if i= 10 initially
concidering both the expressions mutually inclusive ?

a)System.out.println(++i<=0);

b)System.out.println(++i<=10);


1 Answer

6 votes

Answer:

false

false

Step-by-step explanation:

a) since i starts out being 10, it will never be <= 0, so that one is always false.

b) i is incremented just before it is compared to 10, so it will be 11 at the time of the comparison, which will therefore also return false.

User Daniel Antos
by
5.7k points