0% found this document useful (0 votes)
4 views2 pages

Exp 1.4 Java

The document outlines a practical exercise for a student named Aman Kumar Bhati, focusing on determining if a given string is a palindrome using Java. The objective is to understand string reversal, and the provided code checks if the reversed string matches the original. The learning outcomes include knowledge of palindromes and string manipulation techniques.

Uploaded by

amanbhati9528
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Exp 1.4 Java

The document outlines a practical exercise for a student named Aman Kumar Bhati, focusing on determining if a given string is a palindrome using Java. The objective is to understand string reversal, and the provided code checks if the reversed string matches the original. The learning outcomes include knowledge of palindromes and string manipulation techniques.

Uploaded by

amanbhati9528
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Student Name: Aman kumar bhati UID: 21BCS2982

Branch: BE-CSE Section/Group: 609-A


Semester: 3rd Date of Performance:
11/9/22 Subject Name: OOPS using JAVA Subject Code: 21CSH-211

Experiment: 1.4
Aim of the practical: Given a string A, print Yes if it is a palindrome, print No
otherwise.

Objective: The objective of this practical is to understand the concept of how to


reverse a string.

Program code:
import java.io.*;
import java.util.*;

public class Solution {


public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String A=sc.next();
String reversed = new StringBuilder(A).reverse().toString();

if (reversed.equals(A)) {
System.out.println("Yes");
}
else {
System.out.println("No");
}

}
}
Output:

Learning Outcomes:

 Learnt about the concept of palindrome.


 Learnt how to reverse the string.

You might also like