TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Boolean Operation in Java
Alagunila Meganathan
Sep 28, 2019
3.8
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Simple Program that explains the Boolean Operations in Java.
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
Next Recommended Reading
Steps to Run Java Program using Command Prompt