aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Syntax clarification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Syntax clarification" Watch "Syntax clarification" New topic
Author

Syntax clarification

Ajit Sawant
Ranch Hand

Joined: Nov 26, 2008
Posts: 33
Hello,
Partial code from SCJP 6 pg 586:


I did not understand "subset = (TreeSet)times.headSet(1600)" . What is "(TreeSet)times" trying to do? Please clarify.


Ruben Soto
Ranch Hand

Joined: Dec 16, 2008
Posts: 1032
The way that is evaluated is (TreeSet)(times.headSet(1600))
Here, times.headSet(1600) returns a SortedSet reference to a TreeSet, which means that the whole expression is a legal downcast.

All code in my posts, unless a source is explicitly mentioned, is my own.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Syntax clarification