Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null Values?

 
Sam Bluesman
Ranch Hand
Posts: 191
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I keep getting a 'null value' in the allActivitiesLecturerLookupField[counter] memory locations instead of a lecturer's name. Why is this? All arrays have the correct information in them. What is wrong with my code?

[ February 07, 2006: Message edited by: Sam Bluesman ]
[ February 07, 2006: Message edited by: Sam Bluesman ]
 
Martin Mathis
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried using a debugger or output statements so that you can actually see how things are running? I'd assume that the if statement never evaluates to true, so you're left with the initial null values.
 
Sam Bluesman
Ranch Hand
Posts: 191
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it prints out null 5 times. But i dont understand why.
 
Chris Allen
Ranch Hand
Posts: 127
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Unless the two objects point to the same reference in memory, the expression will always be false and hence, never assign the value. I am guessing you want to use the .equals() method instead of == to test whether the objects are equivalent (data-wise) rather than pointing to the same reference in memory.
 
Sam Bluesman
Ranch Hand
Posts: 191
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i use .equals() in this context?
 
Sam Bluesman
Ranch Hand
Posts: 191
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forget the last post. Thank you very much people!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic