• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Brackets or parentheses

 
Seth Mould
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, it should be:



Thanks for your help. I have read the link.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seth Mould wrote: . . .Thanks for your help.
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic