About Question enthuware.ocajp.i.v7.2.1284 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

About Question enthuware.ocajp.i.v7.2.1284 :

Post by ETS User »

Look at this question:

Code: Select all

public class Sample{
   public static void main(String[] args)  {
     String s1 = new String("java");
     StringBuilder s2 = new StringBuilder("java");
     replaceString(s1);
     replaceStringBuffer(s2);
     System.out.println(s1 + s2);
  }
  static void replaceString(String s) {
     s = s.replace('j', 'l');
  }
  static void replaceStringBuilder(StringBuilder s) {
     s.append("c");
  }
}
Pay attention on the call of the method replaceStringBuffer(s2). There is no such a method. The method that should've been called was replaceStringBuilder, so the correct answer is 'None of the above' instead 'javajavac'

Thanks

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1284 :

Post by admin »

You are right. This has now been fixed.

thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests