Java Programming Tutorial - 11 - Logical Operators

package apples;


public class boy {
public static void main (String []args) {
int boy, girl;
boy = 18;
girl = 68;
if(boy > 10) {
System.out.println("You can enter");
} else {
System.out.println("You are too young"); }
}


}
public static void main (String []args) {
int boy, girl;
boy = 18;
girl = 68;
if(boy > 10 && girl < 60) {
System.out.println("You can enter");
} else {
System.out.println("You cannot enter"); }
}

}
package apples;


public class boy {
public static void main (String []args) {
int boy, girl;
boy = 18;
girl = 68;
if(boy > 10 || girl < 60) {
System.out.println("You can enter");
} else {
System.out.println("You cannot enter"); }
}

}


Comments