The Artima Developer Community
Sponsored Link

Java Answers Forum
2D array

1 reply on 1 page. Most recent reply: Nov 9, 2005 9:35 PM by Kondwani Mkandawire

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Jaelyn

Posts: 6
Nickname: tarheel
Registered: Sep, 2005

2D array Posted: Nov 9, 2005 1:32 PM
Reply to this message Reply
Advertisement
I am creating a 2D array with names and room numbers.
Should I declare the array as a double or a string?


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: 2D array Posted: Nov 9, 2005 9:35 PM
Reply to this message Reply
Why don't you declare it to hold Objects.
Then you will be able to hold String and Double
(Note: not double) and cast them when you need to
access them. A little bit confused here, how will you
be indexing it?

Alternatively create a Container that has Getters
for a Room Number and an Occupant. You can then
declare the array to hold this Container lets say its
called Entity. You can then access the room numbers
and the occupants names via the getters at any given
index.

Flat View: This topic has 1 reply on 1 page
Topic: writing methods Previous Topic   Next Topic Topic: Horizontal & Vertical Lines

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use