Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 18th, 2007, 09:11 AM
Authorized User
 
Join Date: Nov 2007
Location: Grimsby, North East Lincolnshire, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chris1012
Default array address problem

hey guys am having a little problem with my coding what am trying to do is am trying to display a set an arrays and all of its values within it on a System.out.println but all i seem to get is the address of the array my code is shown below

can anyone help am just using the code for debugging specifically at the minute and its at test stages:)

        String names [][] = new String [21][2];
        names[0][0]="chris";
        names[0][1]="c";
        names[1][0]="c";
        names[1][1]="c";
        names[2][0]="c";
        names[2][1]="c";
        names[3][0]="c";
        names[3][1]="c";
        names[4][0]="c";
        names[4][1]="c";
        names[5][0]="c";
        names[5][1]="c";
        names[6][0]="c";
        names[6][1]="c";
        names[7][0]="c";
        names[7][1]="c";
        names[0]="c";
        names[1]="c";
        names[9][0]="c";
        names[9][1]="c";
        names[10][0]="c";
        names[10][1]="c";
        names[11][0]="c";
        names[11][1]="c";
        names[12][0]="c";
        names[12][1]="c";
        names[13][0]="c";
        names[13][1]="c";
        names[14][0]="c";
        names[14][1]="c";
        names[15][0]="c";
        names[15][1]="c";
        names[16][0]="c";
        names[16][1]="c";
        names[17][0]="c";
        names[17][1]="c";
        names[18][0]="c";
        names[18][1]="c";
        names[19][0]="c";
        names[19][1]="c";
        names[20][0]="c";
        names[20][1]="c";


        System.out.println("the values entered are"+names);


in opposite world i love programming
__________________
in opposite world i love programming
Reply With Quote
  #2 (permalink)  
Old December 18th, 2007, 09:33 AM
Authorized User
 
Join Date: Dec 2007
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

        System.out.println("the values entered are");
        for(int i=0; i<names.length; i++)
        {
          System.out.print(names[i][0]);
          System.out.print(names[i][1]);
        }


Reply With Quote
  #3 (permalink)  
Old December 18th, 2007, 10:37 AM
Authorized User
 
Join Date: Nov 2007
Location: Grimsby, North East Lincolnshire, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chris1012
Default

cheers dude but is there any way to shorten the amount of code rather than replicating system.out.println i was thinking of using a gui and using case statements to be honest aswell at the end of the day i need to show 2 multidimentional arrays which consist of double values along with sring values and doubles i sort of need to combine them together any ideas let me know

cheers

in opposite world i love programming
Reply With Quote
  #4 (permalink)  
Old December 18th, 2007, 11:46 AM
Authorized User
 
Join Date: Dec 2007
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

did you consider Vector

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with blank fields in Shipping Address radrussell BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 November 23rd, 2009 11:57 AM
Take the address of a stack based array Obnox BOOK: Professional C#, 2nd and 3rd Editions 1 April 21st, 2005 08:12 AM
Problem on VB.net having same structure address nick.tan VB.NET 2002/2003 Basics 0 October 28th, 2004 04:25 AM
how to pass address of an array to a dll(in c++) iceman1188 General .NET 0 May 30th, 2004 09:19 PM
Retreiving IP address & gateway address sjangit VBScript 0 February 3rd, 2004 02:02 PM



All times are GMT -4. The time now is 04:06 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.