---------------------------------------------------
First question
int x = 1,y = 1;
if (x++==2 & ++y==2)//false & True =false; x=2,y=2
{
x = 7;
}
System.out.println ("x=" +x+ ", y=" +y);
The output is:
x=2,y=2
---------------------------------------------------
Second question
int x = 1,y = 1;
if (x++==2 && ++y==2)
{
x = 7;
}
System.out.println ("x=" +x+ ", y=" +y);
The output is:
X=2,y=1
---------------------------------------------------
Third question
int x = 1,y = 1;
if (x++==1 | ++y==1)//true | false = true; x=2,y=2
{
x = 7; x=7,y=2
}
System.out.println ("x=" +x+ ", y=" +y);
The output is:
x=7,y=2
---------------------------------------------------
Question Fourth
int x = 1,y = 1;
if (x++==1 | | ++y==1)
{
x = 7; X=7,y=1
}
System.out.println ("x=" +x+ ", y=" +y);
The output is:
X=7,y=1
---------------------------------------------------
Question Fifth
Boolean B = true; Assign a value of true to B.
if (b = = false)
System.out.println ("a");
else if (b)
System.out.println ("B");
else if (!b)
System.out.println ("C");
Else
System.out.println ("D");
The output is:
B
Improved version:
if (b = false)//This procedure: assign false to B and leave B.
System.out.println ("a");
else if (b)
System.out.println ("B");
else if (!b)
System.out.println ("C");
Else
System.out.println ("D");
The output is:
C
---------------------------------------------------
In the Java language: ++a and a++ small exercises & and && small exercises | with | | Little practice Boolean type little exercise