Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-30-2009, 12:05 AM
Member
 
Join Date: Apr 2009
Posts: 18
Rep Power: 0
leapinlizard is on a distinguished road
Default Null
Hi, This code is fine no error but when i run this program all i get this output:
null null null null null null
null null null null null null
null null null null null null
null null null null null null


Code:
public class examp
{

		static String bookArray[] = new String[5];
		static String dataArray[][] = new String [5][6];

	public static void main(String args[])
	{
		//String bookArray[] = new String[5];
		//buildInstances();
		
		
		//printReport(dataArray[k][0]);
		  printReport();

	 }//main

		public static void buildInstances()
		{	

		 String dataArray[][] = {{"HELLO"," MY NAME"," IS"," Alex"," king","jadu"},
					{"HELLO"," THIS IS"," SE"," LIN"," SECOND","jadu"},
					{"HELLO"," DO U ST"," LL"," REM"," EMBER ","jadu"},
					{"HELLO"," 4TH LIN"," IN"," PRO"," GRESS ","jadu"},
					{"HELLO"," DOWNTOW"," N "," HUH"," HELLO ","jadu"}};

		}
					

		public static void printReport()
		{
		
		for (int i=0; i<bookArray.length; i++)
		{
		   System.out.println(dataArray[i][0]+dataArray[i][1]+dataArray[i][2]+dataArray[i][3]+dataArray[i][4]+dataArray[i][5]);
//,dataArray([i][1]), dataArray([i][2]),dataArray([i][3]),dataArray([i][4]));
		}


		}//print report

//	} //main
}
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 04-30-2009, 12:12 AM
CJSLMAN's Avatar
Moderator
 
Join Date: Oct 2008
Location: Mexico
Posts: 1,159
Rep Power: 3
CJSLMAN is on a distinguished road
Default Does bookArray have any data?
Question: in your code, when did you put data in bookArray?

Luck,
CJSL
__________________
Chris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-30-2009, 12:18 AM
Member
 
Join Date: Apr 2009
Posts: 18
Rep Power: 0
leapinlizard is on a distinguished road
Default
so ok how do i put this in bookArray i'm so confuse
Code:
bookArray[i] = dataArray[i][0]+dataArray[i][1]+dataArray[i][2]+dataArray[i][3]+dataArray[i][4]+dataArray[i][5];
??
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-30-2009, 12:25 AM
Member
 
Join Date: Apr 2009
Posts: 18
Rep Power: 0
leapinlizard is on a distinguished road
Default
yeah i made one sample file to trace the problem but still no luck
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-30-2009, 12:29 AM
OrangeDog's Avatar
Senior Member
 
Join Date: Jan 2009
Location: Cambridge, UK
Posts: 838
Rep Power: 2
OrangeDog is on a distinguished road
Default
As you've commented out the method call, none of your arrays ever have anything assigned to them.
__________________
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check for null int SnarfSnarf New To Java 5 01-31-2009 12:12 AM
Null Error scoleman123 New To Java 2 09-19-2008 05:04 PM
Null value Michael New To Java 4 06-15-2008 07:25 AM
Img.getWidth(null); gives -1 why? willemjav New To Java 0 02-15-2008 03:06 PM
What is NULL bugger New To Java 1 01-09-2008 05:55 PM


All times are GMT +2. The time now is 05:03 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org