| Author |
Brackets or parentheses
|
Seth Mould
Greenhorn
Joined: Oct 25, 2009
Posts: 2
|
|
I've read Java for Dummies and am reading Android Application Development (O'Reilly). I've Googled for 3 hours and cannot find an explanation for the first pair of brackets in this code:
findViewById is (I think) a method of the MapView class and also of other classes, so it looks like (MapView) is qualifying the method.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
Welcome to JavaRanch I see you are cisatlantic, otherwise you would have said "parentheses."
I think you have a spelling error in that code; you may have missed out a = sign. I think it looks like a classcast; you are telling the Compiler that whatever is returned from that method call is a "MapView". I presume your book has details of what a MapView is on some other page. There are more details about casting in the Java™ Language Specification, and they are really easy to read.
One statement in this posting is a lie, d*mned lie, or statistic, as Lord Acton would have said.
|
 |
Seth Mould
Greenhorn
Joined: Oct 25, 2009
Posts: 2
|
|
Sorry, it should be:
Thanks for your help. I have read the link.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
Seth Mould wrote: . . .Thanks for your help.
You're welcome
|
 |
 |
|
|
subject: Brackets or parentheses
|
|
|