How does one go about and try to find all subclasses of a given class (or all implementors of a given interface) in Java?
As of now, I have a method to ...
I have an interface that has a method like this public void method1(Object1 argObj1, Object2 argObj2) In the class that implemtns this method can i have public void method1(Object1 argObj1, SubClassObject2 obj2) where SubClassObj2 is the subclass of Object2? I thought this is possible, but it gives me an error during compilation.
Let say I have two interfaces A and B. They have all but a couple of methods in common. I create a new interface C, and both A and B extends C. We know have the change to implement A, B but also C. And that really doesn't make sense (C is an incomplete contract, not very nice to implement it!) ...
Hola, Class a is a superclass of class b. Class a also implements interface Implementable. Is subclass b required to provide implementation of Implementable although b itself did not explicitly declared that it implements Implementable? [code] public class a implements Implementable { ...//some code here for implementation of Implementable's methods } class b extends a { //does b have to provide ...
Is there a way to list all classes available in the class path? If so, you can use reflection to check for each of the classes if they implement a given interface / extend a given (super) class. However, I'm not exactly sure if there is a way of listing all classes in the class path - afraid there isn't. But ...
The type B does not have a method called print. You're referring to the instance of A through a B reference, so you only have the methods defined by B and the methods it's inherited. By the way, I know you think using names like B, A and I will simplify things for us, but it won't, it's easier to think ...
Hi, wonder if anyone can help. I'm writing a package that provides various tree-related GUI features. I've defined an interface (TreeLayout) which specifies a single static method (layout) that specifies coordinates for the nodes in a tree structure. There are various standard implementations of this interface within the package (eg table layout, tree layout, radial layout etc), but I want other ...
It depends. If m is public then it is already inherited so you don't have to unless you want a overriding implementation. If m is private, it is not, so you have to. If it is protected, the Super Class method cannot hide the public method in the interface, so again, you have to. HTH. -o12
Consider the above scenario. We have a BusRoute and TrainRoute object and both extend the abstract class Route which contains general methods needed by all subclasses. Route implements IRoute. This is straightforward. Notice TrainRoute implements the CountdownRoute interface but BusRoute does not. This is because TrainRoute is capable of starting a countdown operation and the BusRoute is not. CountdownRoute implements the ...