Multiple choice

class Demo {public static void main(String[] args) {StringBufferch=new StringBuffer(DAD); StringBufferst=new StringBuffer(ch);st=st.reverse(); String str=new String(st); String sta=new String(ch); if(str.equals(sta)) System.out.println(…….); else System.out.print(……..);}}

The above written program code

  1. checks whether the two strings are equal or not

  2. reverses the string

  3. check whether the string is palindrome or not

  4. compares the StringBuffer and String object

  5. none of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The above code checks whether the given string is palindrome or not.