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.
if the (whatIsThis) happens to be the name of a data type, such as (int) or (double) or the like, then you're probably looking at a typecast.
that is, the method returns a value of some one type, but the place where the method call is used needs a value of another type. putting the name of the type you need in parentheses before the method call like that tells the javac compiler to try and convert the value returned into the type needed, as best it can.
In general, when an expression is preceded by something in parentheses, this means that the object reference (or primitive value) represented by that expression is explicitly cast to the type specified within the parentheses.
For example, in an ArrayList, the remove(int) method returns a reference to the element removed from the List at the specified index (the int argument). But this reference is likely to be of type Object; so to be of any use, it needs to be explicitly cast back to its true type. [ January 18, 2005: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Jan 18, 2005
Thank you! With this information, I returned to the code and it makes perfect sense now.