25x - Learn Java Logical Operators (AND, OR, XOR, NOR) - Exercise 1

preview_player
Показать описание

In this lesson, we will get practice with writing code to use the logical (boolean) operators in Java. We will focus on "and", "or", "xor" and "nor" which can be used in a wide variety of ways to create complex program function.
Рекомендации по теме
Комментарии
Автор

Hi Jason! Thank you so much for the videos, they have helped me immensely!
With regards to the above exercise, I'm not sure whats wrong with my code, when I enter 30 or 50 both the sentences are printed as out.

public class Lesson_7 {

public static void main(String[] args) {
// TODO Auto-generated method stub

int age = 30;


if ((age >= 25) && (age <= 35));
System.out.println("Your age is between 25 and 35");



if ((age >= 45) && (age <= 55));
System.out.println("Your age is between 45 and 55");

}


}

yasmeenkarachiwala
Автор

I like your videos but in this video I disagree with something.
You have mentioned about age between 25 and 35 but in if statement you have written (age>=..) equal to is not needed in case of between or else what is the meaning of between.. please correct me if I’m wrong.

I’m big fan of your videos. You have helped me understand java so deeply 🙏

kkbb
welcome to shbcf.ru