- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPalindromExample.java
More file actions
Latest commit
21 lines (19 loc) · 674 Bytes
/
Copy pathPalindromExample.java
File metadata and controls
21 lines (19 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
packagecom.codinginterview;
publicclassPalindromExample {
publicstaticvoidmain(String[] args) {
System.out.println("Palindrome Example");
StringinputString = "LUXXUL";
System.out.println(inputString + " String is Palindrome or not ::"+checkPalindrom(inputString));
}
privatestaticbooleancheckPalindrom(StringinputString){
booleanresult = true;
intlength = inputString.length();
for(inti = 0; i< length/2; i++){
if(inputString.charAt(i) != inputString.charAt(length - i - 1)){
result = false;
break;
}
}
returnresult;
}
}