Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Boolean Operation in Java
WhatsApp
Alagunila Meganathan
5y
3.8
k
0
1
25
Blog
booleanOperation.rar
Introduction
In this blog, I am going to explain the program for Boolean Operations in Java.
Software Requirements
Java, Notepad
Program
import
java.io.*;
public
class
booleanOperation {
public
static
void
main(String[] args)
throws
Exception {
try
{
int
a;
int
b;
String str;
BufferedReader in =
new
BufferedReader(
new
InputStreamReader(System.in));
a = Integer.parseInt( in .readLine());
b = Integer.parseInt( in .readLine());
str = in .readLine();
String as =
new
String(str);
System.out.println(
"a = "
+ a +
"and\nb = "
+ b);
System.out.println(a +
" is greater than "
+ b +
" : "
+ (a > b));
System.out.println(a +
" is less than "
+ b +
" : "
+ (a < b));
System.out.println(a +
" is equal to "
+ b +
" : "
+ (a == b));
System.out.println(a +
" is greater or equal to "
+ b +
" : "
+ (a >= b));
System.out.println(a +
" is less than or equal to "
+ b +
" : "
+ (a <= b));
System.out.println(a +
" is not equal to "
+ b +
" : "
+ (a != b));
System.out.println(a +
" is equal to "
+ b +
" : "
+ (a == b));
System.out.println(
"This condition is : "
+ (as.equals(
"Yes"
)));
}
catch
(IOException e) {
System.out.println(e.getMessage());
System.exit(
0
);
}
}
}
Boolean
Boolean Operations in Java
Java
Up Next
Steps to Run Java Program using Command Prompt
Ebook Download
View all
Programming in Java
Read by 629 people
Download Now!
Learn
View all
Membership not found