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:
Campbell Ritchie
Tim Cooke
paul wheaton
Paul Clapham
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Saloon Keepers:
Tim Holloway
Carey Brown
Roland Mueller
Piet Souris
Bartenders:
Forum:
Programmer Certification (OCPJP)
casting
Shardul Kumar
Greenhorn
Posts: 12
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.io.*; class A{} class B extends A{} class C extends A implements Serializable{} final class D extends B{} public class Refcast{ public static void main(String args[]){ A a=new A(); B b=new B(); C c=new C(); D d=new D(); Object ob=c; //Line-1 d=(D)ob; //Line-2 d=(D)new B(); //Line-3 c=(C)new Serializable(){}; //Line-4 } }
how line 2 is working and rest of the line followed by it..
actually this problem is about which lines give an exception..
Siva Masilamani
Ranch Hand
Posts: 385
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Has been discussed here.
Link
SCJP 6,SCWCD 5,SCBCD 5
Failure is not an option.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Devaka's Practice Exam1
Cast with Runnable interface.
Inner Class Doubt
Interface instance?
Casting a supertype to a subtype
More...