Results 1 to 3 of 3
Thread: Error meaning
- 10-15-2012, 03:19 PM #1
Senior Member
- Join Date
- Oct 2010
- Posts
- 139
- Rep Power
- 0
- 10-15-2012, 03:27 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: Error meaning
The JVM is attempting to call a method/access an attribute on a reference that is null.
In the above the someAttribute reference is never initialised to point to a String object, so it is defaulted to null.Java Code:public SomeClass { private String someAttribute; public SomeClass () { System.out.println(someAttribute.length()); } }
The attempt in the constructor to access the length() method will result in a null pointer exception.Please do not ask for code as refusal often offends.
- 10-16-2012, 10:11 AM #3
Senior Member
- Join Date
- Oct 2010
- Posts
- 139
- Rep Power
- 0
Similar Threads
-
What is the meaning of the char(0x00)?
By Lionlev in forum New To JavaReplies: 8Last Post: 06-10-2012, 12:28 PM -
The meaning of replaceAll
By herolua in forum New To JavaReplies: 4Last Post: 10-07-2011, 05:18 AM -
Phrase Meaning
By griddle in forum New To JavaReplies: 1Last Post: 04-25-2011, 06:45 PM -
for loop meaning
By ahmakki in forum New To JavaReplies: 3Last Post: 04-12-2010, 01:06 AM -
Exception:Meaning
By tiger100plus in forum New To JavaReplies: 2Last Post: 11-27-2008, 07:45 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks