File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes interface again 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 "interface again" Watch "interface again" New topic
Author

interface again

Neha Sawant
Ranch Hand

Joined: Oct 11, 2001
Posts: 204

this code is complaining that Observer interface not found in class B1.
what is my mistake here.
Anyone please
class A implements Runnable{
public void run(){}}
class B1 extends A implements Observer {
public static void main(String args[]){
A a = new A() ;
B1 b = new B1();
Object o=a; Runnable r = o;
Object o=a; Runnable r = (Runnable)o;
//Object o=a; Observer ob = (Observer)o;
Object o=b; Observer o2 = o;
Object o=b; Runnable r = (Runnable)b;
Object o=b; Observer o2 =(Observer)o;
Observer o=new B();
}


nss
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Did you import the package they're in (java.util)?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
import java.util.*;
do you have that?
Neha Sawant
Ranch Hand

Joined: Oct 11, 2001
Posts: 204
thanx Micheal And FEING
That was my mistake.
Will we be tested on these also.
i.e. do we have to point out whether import statement is missing
_Neha
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: interface again
 
Similar Threads
casting rules-ques from jq+
Annonymous Inner Class
Interface and Casting
Question regarding a CampFire Story
variables