This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
int i ; i<=5?1:0; System.out.println(i); When it is compiled, the screen prints "not a statement". i<=5?1:0; ^ What does it mean? Or where is the error?
First, the local variable 'i' is not initialized; you must explicitly initialize it int i=0; Secondly, the ternary operator returns a value and that value must be assigned to a variable int i = 0; int result = 0; result = i<=5?1:0; or you can print the result directly System.out.println(i<=5?1:0);
byte i=125; i<<-4
This shift expression is equivalent to i<<124. To learn more about negative shifting you can check out MM post here
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!