Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Boolean Operation in Java
WhatsApp
Alagunila Meganathan
5y
3.9
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
);
}
}
}
Java
Boolean
Boolean Operations in Java
Up Next
Swap two numbers without using third variable in java
Ebook Download
View all
Solutions Manual to Objects First with Java – A Practical Introduction using BlueJ
Read by 1.8k people
Download Now!
Learn
View all
Membership not found