The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

problem in java

Posted by gopal on May 31, 2001 at 10:41 AM

hi
i made a class like this
class a extends Object implements Runnable
{
public static void main(String s[])
{
a a1=new a();
Object o=a1;
Runnable r=o;
}}
however this does not compiler as it asks for a explicit cast
however changing the program as
Runnable r=a1;
Object o=r;
does not require any cast .please explain why.
gopal



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us