
public class Myclass { Public static void main(String args[]) { String s=â??helloâ??; StringBuffer sb=new StringBuffer(s); Sb.reverse(); If(s==sb) system.out.println(â??aâ??); If(s.equals(sb)) system.out.println(â??bâ??); If(sb.equals(s)) system.out.println(â??câ??); } } Output?
a) the pgm will throw ClassCastException b) compilation fails since s==sb illegal c) compilation fails since s.equals(sb) illegal d) print c
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.