2 Replies Latest reply: Jan 3, 2008 6:22 AM by 807603 RSS

    Object references and array of integers

    807603
      Hello,

      Taking some java test, I came across the following question:

      Given the below (UML) diagram, how many of the ClassA attributes will be object references when this class is implemented in the Java language?:
             ClassA                                         <<enumeration>>    
                                    ------------------->         Enum1
            var1 : int                                               
            var2 : String                                         Elem1
            var3 : int[]                                          Elem2
            var4 : float                                          Elem3
            var5 : Double                                         Elem4
            var6 : Enum1   
      I answered 3, but the correct answer was 4. The one which I did not include was var3. Why will var3 be an object reference?

      Thank you,
      Mihai