Logical and operation (With boolean variables)

0 Arnab Banerjee · January 24, 2015
How to perform a logical and operation with boolean variables

public class prog2{

public static void main(String args[]){
boolean a = true;
boolean b = false;
System.out.println("The logical operation is " + (a & b);
}
}

Here is my code and it is showing an error.

Post a Reply

Replies

Oldest  Newest  Rating
+1 Bernard Pyc0d333 Parah · January 24, 2015
System.out.println("The logical operation is " + (a & b)); 

I don't think this is possible, what do you expect it to print and what are they both evaluating?
+1 Arnab Banerjee · January 24, 2015
Thanks Bernard, The code is now working. :)
+1 Bernard Pyc0d333 Parah · January 24, 2015
cool
  • 1

Java / Android Development

107,024 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator