a small java question:

Discussion in 'OT Technology' started by nietsni3, Nov 29, 2004.

  1. nietsni3

    nietsni3 Guest

    this is a quiz question in my java textbook:
    "A value-returning method returns only one value."
    true or false?

    this question i think is not clear. please help. thanks
     
  2. Nocera

    Nocera ...

    Joined:
    Aug 9, 2000
    Messages:
    1,307
    Likes Received:
    0
    Location:
    Long Island, NY
    Define "value." A method can return an object or an array that contains multiple values.
     
  3. korrupshun

    korrupshun New Member

    Joined:
    Sep 8, 2004
    Messages:
    389
    Likes Received:
    0
    Location:
    YourMommasHouse
    pretty sure this is true, think about method construction:

    public static int foo(){}

    there are not int,int,double method declarations, and in the case of an object, it is still only ONE item/value
     
  4. korrupshun

    korrupshun New Member

    Joined:
    Sep 8, 2004
    Messages:
    389
    Likes Received:
    0
    Location:
    YourMommasHouse
    dont think it does, a method can only return three things: an object, a primitive, or void

    all of which are singular, even though an object like a vector can contain many objects, they are encapsulated into ONE.....
     
  5. unimatrix

    unimatrix New Member

    Joined:
    Dec 12, 2003
    Messages:
    3,133
    Likes Received:
    0
    Location:
    Atlanta
    A method can return only one object, regardless of type or how many other "values" that object may contain.
     
  6. WERUreo

    WERUreo Imua!

    Joined:
    Oct 15, 2003
    Messages:
    566
    Likes Received:
    0
    Location:
    Daytona Beach, Florida
    Just did a Google search on "value-returning method" and it seems that everywhere, it is used to distinguish methods that return values from void methods. So, I'm gonna have to go with true for that. I think at first glance, we're all looking too much at the semantics of the statement.
     
  7. Up All Night

    Up All Night I might sleep all day

    Joined:
    Jan 23, 2004
    Messages:
    2,104
    Likes Received:
    0

Share This Page