• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Array place getting null itself

 
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
i have 2D array and initialise it with nested loop. More specific in place array[11][2] initialise it as element of another class i created. Now if i use system.out to print this place after the end of loop, content is ok, but if i print it in a method i created is null!!! Im not doing anything in that place in that method, just system.out. Any idea???
thank you

EDIT: Noticed that in method all elements of the array are NULL.Why? when that happens?
 
Ranch Hand
Posts: 96
Eclipse IDE Oracle Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without seeing any code I can think of a few possible causes:
- scope
- assignment going wrong
- ..

Wim
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is impossible to say without seeing your code. Clearly you are doing something wrong, or not doing something right. So please post what you have (and only the relevant part please!!!).

 
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If all the elements of your array or null it seems like your initializing the array incorrectly. Look through the Java array tutorial and see if that helps you figure it out.
http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

Hunter
 
reply
    Bookmark Topic Watch Topic
  • New Topic