This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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