String a="hello";String b=a+"how r u";String c=b+"buddy";How many objects are there in the above code?

Questions by dhanyareedu

Showing Answers 1 - 2 of 2 Answers

three Different object's
u can go through the following prog
public class Demo {
               public static void main(String args[]) {

  String a="hello";
  String b=a+"how r u";
  String c=b+"buddy";
  System.out.println(a.hashCode());
  System.out.println(b.hashCode());
  System.out.println(c.hashCode());
 
        } 



the out put for the above program having different hashCode's for each.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions