Question: Construct an array of 3 String objects containing the strings "a", "b", "c", using the {} notation. Call the string by the variable name s. Answer: String s = {"a","b","c"}; shouldn't there be an indication of an array somewhere? I get a compiler error with this. My answer was String[] s = {"a","b","c"}; Eric
Ashish Thakur
Greenhorn
Joined: Mar 18, 2000
Posts: 22
posted
0
In my opinion ur answer is fine. when u said : shouldn't there be an indication of an array somewhere? I get a compiler error with this. My answer was String[] s = {"a","b","c"}; the "this" meant the previous code right?, cause ur code will not have a problem unless u try to declare it within a method. Also the question is quite out of line when it says "Call the string by the variable name s" it should have said, "Call the array by the variable name s" or "Call the string array by the variable name s" Anybody has any other opinion??
Yes, I did mean the previous code but it wasn't clear. Thanks for the reply. Eric
maha anna
Ranch Hand
Joined: Jan 31, 2000
Posts: 1467
posted
0
Eric, I also seen this qstn somewhere while I was preparing for the exam. But I don't remember what the author said. Where is this qstn from. We can move to Errata. regds maha anna