

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to check a string is palindrome or not in Jshell in Java 9?
JShell is the first REPL(Read-Evaluate-Print-Loop) interactive tool that has been introduced as a part of Java 9. It evaluates declarations, statements, and expressions as entered and immediately shows the results, and it runs from the command-line prompt.
Palindrome string is a string where it remains the same when reversed or word spelled the same way in both forward and backward directions.
In the below example, we can able to check whether the given string is palindrome or not in the JShell tool.
C:\Users\User>jshell | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> String str="LEVEL"; str ==> "LEVEL" jshell> String revstring=""; revstring ==> "" jshell> { ...> for(int i=str.length()-1; i>=0; --i) { ...> revstring +=str.charAt(i); ...> } ...> System.out.println(revstring); ...> if(revstring.equalsIgnoreCase(str)){ ...> System.out.println("String is Palindrome"); ...> } else { ...> System.out.println("String is not Palindrome"); ...> } ...> } LEVEL String is Palindrome
- Related Questions & Answers
- Program to check a string is palindrome or not in Python
- How to Check Whether a String is Palindrome or Not using Python?
- C# program to check if a string is palindrome or not
- Python program to check if a string is palindrome or not
- How to implement a String in JShell in Java 9?
- Check if any anagram of a string is palindrome or not in Python
- Python Program to Check Whether a String is a Palindrome or not Using Recursion
- Program to check string is palindrome or not with equivalent pairs in Python
- Program to check string is palindrome with lowercase characters or not in Python
- Program to check a number is palindrome or not without help of a string in Python
- JShell in Java 9?
- How to check Palindrome String in java?
- C++ Program to Check Whether a Number is Palindrome or Not
- How to debug JShell in Java 9?
- Java Program to check if a string is empty or not
Advertisements