JAVA WEEK3(A)
/* Week 3 : a) Write a Java program that checks whether a given string is a
palindrome or not. Ex: MADAM is ...
Upcoming SlideShare
Loading in …5
×

Java Week3(A) Notepad

535 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
535
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java Week3(A) Notepad

  1. 1. JAVA WEEK3(A) /* Week 3 : a) Write a Java program that checks whether a given string is a palindrome or not. Ex: MADAM is a palindrome. */ import java.util.*; public class LabPro4 { public static void main(String args[]) { StringBuffer sb=new StringBuffer(args[0]); String t=sb.reverse().toString(); System.out.println("reverse "+t); System.out.println("boolean results"); System.out.println("check with == "+(t==args[0])); System.out.println("check with equals "+(t.equals(args[0]))); System.out.println("given string "+args[0]); if(t.equals(args[0])) System.out.println("is a pallindrome"); else System.out.println("is not a pallindrome"); } } Page 1

×