Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
Added palindrome checker in java (#473)
Browse files Browse the repository at this point in the history
* Added palindrome checker in java

* Changes made as requested
  • Loading branch information
ayush-1909 authored Oct 6, 2021
1 parent a7cf50e commit 7ce5e73
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Programming/Java/PalindromeOrNot/PalindromeCheck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.raven7;

import java.util.Scanner;

class PalindromeCheck{
public static void main(String args[])
{
String original, reverse = ""; // Objects of String class
Scanner in = new Scanner(System.in);
System.out.println("Enter the number: ");
original = in.nextLine();
int length = original.length();
for ( int i = length - 1; i >= 0; i-- )
reverse = reverse + original.charAt(i);
if (original.equals(reverse))
System.out.println("True");
else
System.out.println("False");
}
}

0 comments on commit 7ce5e73

Please sign in to comment.