DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3

Thread: arrays

  1. #1
    markos Guest

    arrays


    hi i am learning java and run into a problem with an array. Can anyone tell
    me how to use a 2 dim array ? I need to store a name for example and a grade
    value
    so it shoujld look like this
    Angel 4
    Micheal 3
    etc..
    can i do this using 2 dim array ? Thanks.

  2. #2
    Tom Duffy Guest

    Re: arrays


    Hello markos:

    Sure, you can store anything you want in an array - including objects, which
    might be the way to go here. Instead of creating a 2D array, why not create
    objects that have two instance variables, a String and and int, and then
    store the objects in a single array. That way you won't have to keep track
    of all of those indices.

    HTH,

    Tom Duffy

    "markos" <markospolo@aol.com> wrote:
    >
    >hi i am learning java and run into a problem with an array. Can anyone tell
    >me how to use a 2 dim array ? I need to store a name for example and a grade
    >value
    >so it shoujld look like this
    >Angel 4
    >Micheal 3
    >etc..
    >can i do this using 2 dim array ? Thanks.



  3. #3
    markos Guest

    Re: arrays


    I need it for study purposes.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links