62 572
Assignments Done
99%
Successfully Done
In June 2018

Answer to Question #3569 in Java | JSP | JSF for Y mukundareddy

Question #3569
(4) Write a program to perform all the logical operators on the following two variables, a= 10,b=5?
Expert's answer
There are four logical operators - &, &&, | and | |.
| | And && can only be used in logical expressions.





public class Main {




public static void main(String[] args) {

boolean a = true, b = false;

int i = 10, j = 5;




System.out.println("a & b: " + (a&b));

System.out.println("a | b: " + (a|b));

System.out.println("a && b: " + (a&&b));

System.out.println("a || b: " + (a||b));

System.out.println("i & j: " + (i&j));

System.out.println("i | j: " + (i|j));

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions