Page 2 of 2 FirstFirst 12
Results 21 to 30 of 30
  1. #21
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    I'm not clear that you want to add a local variable or an object. It's possible in Java.

    Here is an example code,

    Java Code:
            int val1 = 20;
            int val2 = 23;
            int[] arr = new int[]{val1, val2};
            for(int i = 0; i < arr.length; i++)
                System.out.println(arr[i]);

  2. #22
    SKYLINEGTR is offline Member
    Join Date
    Nov 2008
    Posts
    14
    Rep Power
    0

    Default

    end di okihliugfs g
    thx
    Last edited by SKYLINEGTR; 11-21-2008 at 02:45 PM.

  3. #23
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Can you explain your question more clearly with an example.

    You have an array of type Card, which holds 5 Card object, is it?

    Then you print the first element of the array to the console, what you get?

    What is the variable i, what type it is?

  4. #24
    SKYLINEGTR is offline Member
    Join Date
    Nov 2008
    Posts
    14
    Rep Power
    0

    Default

    comos es le dasdfw
    Last edited by SKYLINEGTR; 11-21-2008 at 02:44 PM.

  5. #25
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  6. #26
    SKYLINEGTR is offline Member
    Join Date
    Nov 2008
    Posts
    14
    Rep Power
    0

    Default

    end di manNa
    Last edited by SKYLINEGTR; 11-21-2008 at 02:44 PM.

  7. #27
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    7

    Default

    just set another variable. like currentCard = card[i].

    just make sure its outside your loop or put a conditional statement within your loop so currentCard doesnt get re-defined each time.

  8. #28
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by SKYLINEGTR View Post
    Yes but what to i refer to the 'current Card' being looked at in the array
    Use another variable to holds the current card. Define it outside the for loop and assign the current value inside the loop, so it wont define again and again when you assign the current card into that variable.

  9. #29
    SKYLINEGTR is offline Member
    Join Date
    Nov 2008
    Posts
    14
    Rep Power
    0

    Default

    hablas english
    Last edited by SKYLINEGTR; 11-21-2008 at 02:44 PM.

  10. #30
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by SKYLINEGTR View Post
    hablas english
    Can you explain much clearly what you are trying to say? Didn't you understand what above few answers explain on your question?

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •