java - find out the type of class which implements of other classes

Posted by Johnzzz on Stack Overflow See other posts from Stack Overflow or by Johnzzz
Published on 2012-04-14T16:55:39Z Indexed on 2012/04/14 17:29 UTC
Read the original article Hit count: 147

Filed under:
|
|

i have a kind of specific problem, let's say, that i have

public interface A {
}

//------------------------------

public class B implements A{

    static int countx = 0;
}
//----------------------------------
public class C implements A{

    static int county = 0;
}
//----------------------------------

public class Arc {

    public A from;
    public A to;

//======================================== and now I have an object a (which is an instance of Arc) and I want to find out whether it is an instance of B or C and get to the atributes countX or countY (stg like a.from.countX) any ideas? :)

© Stack Overflow or respective owner

Related posts about java

Related posts about class