I'm really new to Java, but it sucks all my free time, it's very interesting to study, but I need a little help.
Here's an example of Boolean test from Schildt's book:
public class BooleanTest {
public static void main(String args[]){
boolean b;
b = false;
System.out.println("Expression b " +b);
b = true;
System.out.println("Expression b " + b);
if (b) System.out.println("This code is ok.");
b = false;
if (b) System.out.println("This code is not ok.");
System.out.println("10 > 9 " + (10>9));
}}
This code shows me result:
Expression b false
Expression b true
This code is ok.
10 > 9 true
First line is ok, second is ok, third too, but why the fourth doesn't show me "The code is not ok.", 'cause there is "b=false" and it should say that? Why it jumps to the last System.out.println?
Can someone add commentaries to this example? Thanks a lot!
Aucun commentaire:
Enregistrer un commentaire