Page 1 of 1

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

Posted: Sat Apr 13, 2013 7:55 am
by darran85
The question says
Which of these are not part of the StringBuilder class?

You mark as correct

setLength(int)

that IS part of the StringBuilder class. I think there's an error in this question!

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

Posted: Sat Apr 13, 2013 9:11 am
by admin
I see that it is marked as incorrect.

HTH,
Paul.

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

Posted: Mon Nov 05, 2018 7:16 am
by Arold Aroldson
What exactly we should know about StringBuilder class? I've never seen and/or used setLength method, for example.

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

Posted: Mon Nov 05, 2018 8:50 am
by admin

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

Posted: Wed Dec 09, 2020 12:40 am
by promtbvb
Hi,
09 - Working with Java API - String, StringBuilder    Easy.png
09 - Working with Java API - String, StringBuilder Easy.png (49.15 KiB) Viewed 2950 times
There are 2 correct answers trim() and setLengght(), but only one is marked as correct.
Am I missing something?

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

Posted: Wed Dec 09, 2020 2:56 am
by admin
No, there is only one correct option i.e. option 1.
Please read the question carefully. It says "NOT part of".

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

Posted: Sun Feb 12, 2023 5:52 am
by noeloo
Not sure where is the setLength method description copied from, but it describes string buffer, while the question is not about StringBuffer?
Javadoc of setLenght in AbstractStringBuilder doesn't mention neither string builder not buffer.
Sets the length of the character sequence.

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

Posted: Sun Feb 12, 2023 11:53 am
by admin
Both StringBuilder and StringBuffer are based on an internal "buffer" of characters or character sequence. The description is applicable to both.

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

Posted: Tue Feb 14, 2023 7:27 am
by noeloo
This looks like Javadoc, maybe the old one. Wouldn't it be better to include the new one in the question? Also it is technically not StringBuffer, so if you want to keep it and you say there are based on string buffer, shouldn't it say "underlying buffer" rather than "this string buffer"? This sentence just sounds like this StringBuilder is somehow a buffer.

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

Posted: Tue Feb 14, 2023 10:30 am
by admin
Yes, I agree.