This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Mock Exam Errata and the fly likes Boone #50 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Boone #50" Watch "Boone #50" New topic
Author

Boone #50

Jay S
Greenhorn

Joined: Jan 09, 2001
Posts: 13
Hi,
What does the following line of code do?
TextField tf = new TextField(30);
Select the one right answer.
a.This code is illegal; there is no such constructor for TextField.
b.Creates a TextField object that can hold 30 rows, but since it is not initialized to anything, it will always be empty.
c.Creates a TextField object that can hold 30 columns, but since it is not initialized to anything, it will always be empty.
d.This code creates a TextField object that can hold 30 rows of text.
e.Creates a new TextField object that is 30 columns of text.
I thought the answer is C but it came out as E. Isn't it empty textfield with 30 column capacity.
Any comments are welcome.
Thanks
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
The trick here is that they say it will ALWAYS be empty. You can set the text of the textfield so it won't always be empty, it will just initially be empty.
By the way, Jay S is not a name that comforms to our naming conventions here at the ranch. Please re-register with a more appropriate name. Take a look at this page, www.javaranch.com/name.jsp for more info.
Thanks,
Bill
Lala Viswanath
Greenhorn

Joined: Dec 29, 2000
Posts: 9
Hi Jay,
The answer is e only because if you want to make the textfield
empty you specify in the constructor as new TextField("",30)
This is the right way to make empty.

Regards
Lala

Lala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Boone #50
 
Similar Threads
read text file and save data into database
tricky textfields !
Some confusing ones part 3
TextArea
sarga mock 1