Write code that will take in a String input and check to see if it is a palindrome or not. A palindrome means that the c

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Write code that will take in a String input and check to see if it is a palindrome or not. A palindrome means that the c

Post by answerhappygod »

Write code that will take in a String input and check to see if
it is a palindrome or not.
A palindrome means that the characters are the same forwards and
backwards, ignoring spaces.
Examples of palindromes:
Your check should be case insensitive too. For example, "Bob" is
a palindrome, despite the first B being capitalized.
Your program will print out "true" if it's a palindrome and
"false" if not.
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
System.out.print("In:");
String s = inp.nextLine();
//write your code below
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply