Results 1 to 5 of 5

Thread: Null

  1. #1
    leapinlizard is offline Member
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    0

    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


    Java 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
    }

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    13

    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.

  3. #3
    leapinlizard is offline Member
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    0

    Default

    so ok how do i put this in bookArray i'm so confuse
    Java Code:
    bookArray[i] = dataArray[i][0]+dataArray[i][1]+dataArray[i][2]+dataArray[i][3]+dataArray[i][4]+dataArray[i][5];
    ??

  4. #4
    leapinlizard is offline Member
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    0

    Default

    yeah i made one sample file to trace the problem but still no luck

  5. #5
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    12

    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

Similar Threads

  1. Check for null int
    By SnarfSnarf in forum New To Java
    Replies: 5
    Last Post: 01-30-2009, 11:12 PM
  2. Null Error
    By scoleman123 in forum New To Java
    Replies: 2
    Last Post: 09-19-2008, 04:04 PM
  3. Null value
    By Michael in forum New To Java
    Replies: 4
    Last Post: 06-15-2008, 06:25 AM
  4. Img.getWidth(null); gives -1 why?
    By willemjav in forum New To Java
    Replies: 0
    Last Post: 02-15-2008, 02:06 PM
  5. What is NULL
    By bugger in forum New To Java
    Replies: 1
    Last Post: 01-09-2008, 04:55 PM

Posting Permissions

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