Home > Back-end >  Today share two very simple but small white is easy to ignore the problem
Today share two very simple but small white is easy to ignore the problem

Time:09-21

Problem a


Int hour=1;
Int min=2;
Int the SEC=3;
//write their output
System. Out. Println (hour + min, SEC);
System. The out. Println (hour + min + SEC + "");
System. The out. Println (hour + min + "" + SEC);
System. Out. Println (hour + "" + min, SEC);
System. The out. Println (" "+ hour + min + SEC);
System. The out. Println (" "+ (hour + min, SEC));



Question 2
Int a=3, b=5;
//a Boolean b1=(+ a + a==3) & amp; & (+ + b==5);
//System. Out. Println (b1).
//System. Out. Println (a);
//System. Out. Println (b);
Boolean b2=(+ a + a==4) | | (+ a + b==5).
System. The out. Println (b2);
System. The out. Println (a);
System. The out. Println (b);



Problem a result
6
6
33
123
123
6
As long as when + +. Both sides have a side is string + when the string concatenation operator
Problem two results
True
4
5
Reason: because the Boolean b1=(+ a + a==3) & amp; & (+ + b==5); When + + a==3 behind the false expressions will not perform a=4 b=5
Boolean b2=(+ a + a==4) | | (+ a + b==5). Behind the (+ a + b==5) also does not perform a=4 b=5
  • Related