On Thu, 5 Jul 2001, Bob Tanner wrote:

> Having problems with Java reflection.
> 
> public class A {
>   public MyClassB myB;
>   public MyClassC myC;
> 
>   public void count(Object obj) {
>     Class myClass = obj.getClass();
>     Class[] publicClasses = myClass.getClasses();
>     System.out.println("Num public classes:"+publicClasses.length);
> }
> 
> That code snippet returns 0, shouldn't it return 2?

Why? you don't have any reference to a class that has the other
publicClasses. Ie., and perhaps my eyes are just too tired this morning,
Where are you defining obj as an object of A? (I'm assuming this since you
said it should return two, and I'm assming that's refering to MyClassB and
MyClassC.

Liz


-- 
Imagination is intelligence having fun...
e-mail:  kethry at winternet.com
URL:  http://WWW.winternet.com/~kethry/index.html