MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / CheckPalindrome

Class CheckPalindrome

Java/String/CheckPalindrome.java:6–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4package String;
5import java.util.Scanner;
6public class CheckPalindrome {
7
8 public static boolean check(String str) {
9 String reversed = "";
10
11 boolean ispal = false;
12 for (int i = 0; i < str.length(); i++) {
13 reversed = str.charAt(i) + reversed;
14 }
15 if (reversed.equals(str)) {
16 ispal = true;
17 }
18 return ispal;
19 }
20 public static void main(String[] args) {
21 Scanner sc = new Scanner(System.in);
22 String str = sc.nextLine();
23 boolean check = check(str);
24 System.out.println(check);
25 }
26
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected