Copy and paste the following Java program in Test.java file and compile and run this program −
Example
public class Test {This will produce the following result −
public static void main(String args[]) {
boolean a = true;
boolean b = false;
System.out.println("a && b = " + (a&&b));
System.out.println("a || b = " + (a||b) );
System.out.println("!(a && b) = " + !(a && b));
}
}
Output
a && b = false
a || b = true
!(a && b) = true
No comments:
Post a Comment