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
Character Comparision Ignore Case Program In Java
Alagunila Meganathan
Aug 20
2016
Code
626
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
CharCompIgnoreCase.r
import
java.lang.*;
public
class
CharCompIgnoreCase{
public
static
void
main(String[] args) {
System.out.println(
"Character comparation to ignore case example!"
);
String str1 =
"Vinod"
;
String str2 =
"Vinod"
;
String str3 =
"vinod"
;
CharComp(str1, str2, str3);
}
public
static
void
CharComp(String str1, String str2, String str3){
System.out.println(
"String1 = "
+ str1);
System.out.println(
"String2 = "
+ str2);
System.out.println(
"String2 = "
+ str3);
if
(str1.compareToIgnoreCase(str2) == 0){
System.out.println(
"String1 and String2 are equal!"
);
}
else
{
System.out.println(
"String1 and String2 are not equal!"
);
}
if
(str1.compareToIgnoreCase(str3) == 0){
System.out.println(
"String1 and String3 are equal!"
);
}
else
{
System.out.println(
"String1 and String3 are not equal!"
);
}
if
(str2.compareToIgnoreCase(str3) == 0){
System.out.println(
"String2 and String3 are equal!"
);
}
else
{
System.out.println(
"String2 and String3 are not equal!"
);
}
}
}
Character Comparision Ignore Case Program
Java