wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Brackets or parentheses 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 » Java » Beginning Java
Bookmark "Brackets or parentheses" Watch "Brackets or parentheses" New topic
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: 37907
    
  22
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: 37907
    
  22
Seth Mould wrote: . . .Thanks for your help.
You're welcome
 
 
subject: Brackets or parentheses
 
Similar Threads
how to use distanceBetween built in methog
It prints me pointer repeatedly
Google map: Overlay doesn't work
street view & satilite view is not working
how to add a google search option