aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes interfaces 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 "interfaces" Watch "interfaces" New topic
Author

interfaces

amrit singh
Ranch Hand

Joined: Nov 03, 2000
Posts: 42
hi !!!
could ne one pls explain what happen
1)when a class implements two interfaces that declares same method.if possible with example
2)consider this
interface cintf{
void disp();
}
class cclass implements cintf{
public void disp(){}
public void another(){}
}
class test{
cintf c=new cclass();
//how can i access another() method here using refrence c
}
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
For the first question, do it and see what happens. Here is some code you can use to play with. I am not trying to not give you the answer, I just want to help you play with code on your own and compile and test things. It is the best way to learn.

As for your second question, you can't access the class method if the type is an interface. You would need to cast it back down to the class to be able to access the method in the class.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: interfaces