File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Additional Use for Parentheses. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Additional Use for Parentheses." Watch "Additional Use for Parentheses." New topic
Author

Additional Use for Parentheses.

Eden Landau
Ranch Hand

Joined: Aug 14, 2011
Posts: 40

Hello! I came across this bit of code the other day.
Can anyone tell me what role do the oddly placed parentheses in line 67 play?
Thank you all very much!

Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

Do you mean this line?

The (JButton) is a type cast. It means that the compiler should treat whatever object e.getSource() returns as if it is a JButton object.

There's some information about type casting on this page from Oracle's Java Tutorials.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Eden Landau
Ranch Hand

Joined: Aug 14, 2011
Posts: 40

That solves it then! Thank you very much!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Additional Use for Parentheses.
 
Similar Threads
Java Programming Help (conversions)
JMenuBar hidden...
Press a button and draw a shape
JMenuBar hidden...
How can I diplay and Applet on a swing application?