aspose 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

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "interface again" Watch "interface again" New topic

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();

Michael Ernest
High Plains Drifter

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
Have you tried LearnNowOnline?
subject: interface again