Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
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
Character Comparision Ignore Case Program In Java
WhatsApp
Alagunila Meganathan
Aug 20
2016
654
0
0
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
Up Next
Character Comparision Ignore Case Program In Java