Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
Programmer Certification (OCPJP)
just for fun2 - for the uninitiated
Anshuman Acharya
Ranch Hand
Posts: 144
posted 24 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
this compiles:
//code
class a{
public static void main(
String
args[]){
Runnable r = (Runnable) (new a());
//String[] s = (String[])(new a()); this stat. doesn't compile
}}
//code ends
try putting final before class a and see.
natarajan meghanathan
Ranch Hand
Posts: 130
posted 24 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
A non-final class can be cast to an interface and vice-versa. (RHE Pg. 117).
A reference of Object only can be cast to an array (again RHE Pg.117).
Sun Certified Programmer for Java 2 Platform
Anshuman Acharya
Ranch Hand
Posts: 144
posted 24 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
sorry, nat!
for an object array, even it's superclass' arrayis allowed to refer it...
primitive arrays can be cast to themselves, Object or Cloneable.
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How setDaemon works
a question of anonymous class
Concurrency with 2-cores-CPU
Thread, Runnable and their run() method
anonymous class
More...