This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in appending data to array

 
preethi balaJain
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to use 3 dimensional array(because i need data heirarchy).I can not able to add data to the array.I'm getting null pointer exception.Can anyone help me.Is there any other better way to do it?
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The last dimension needs to be initialized too ...
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
preethi balaJain wrote:... I'm getting null pointer exception...

How does this compile with the incompatible types? "test_new" is declared as a 3-dimensional String array. But then a new 3-dimensional Rectangle array is created and assigned to test_new.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic