• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Ques from KAM

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!
I have a doubt regarding the Exercise Ques.in KAM 10.23(Pg:321).
10.23) Which of these parameter lists have a
corresponding constructor in the StringBuffer
class?
a) ()
b) (int capacity)
c) (char[] data)
d) (String str)
answer given in the book is
(a),(b) and (d)
The StringBuffer class does not have a constructor
that takes an array of char as a parameter.
My doubt is:
Doesn't the overloaded method append() of StringBuffer
class has a signature as follows:
StringBuffer append(char[] str)
It is also given in the KAM (Pg:318) under the section
Appending, Inserting, and Deleting Characters in String Buffers.
Is the answer given wrong? Should not it be
(a),(b),(c)and(d).
Please clarify.
Thanks in advance!
Meenakshi


 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Meenakshi!
The answer given is correct, it should be (a),(b) and (d). These are the only 3 constructors the StringBuffer class accepts.
You are also correct about the append(char[] str), but this is Not a constructor, it is a method provided by the StringBuffer class.
Regards
------------------
Dominic Steng�rd
Sun Certified Java 2 Programmer
------------------

[This message has been edited by Dominic Steng�rd (edited February 06, 2001).]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i very well agree with dominic.
well if u r a mumbaite u can join our forum.
for more check out the topic by me "anyone appearing for scjp in march"
regds
nav
 
Meenakshi_Agarwal
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Navin and Dominic!
It was silly of me to overlook the word 'constructor' in the question. Thanks again for your prompt reply. With this I have also realized the amount of concentration that one needs to put in, for this Exam in particular.
Thanks once again.
Meenakshi
 
reply
    Bookmark Topic Watch Topic
  • New Topic