i triedx another recursion exercise... but unfortunately... the program runs.. until the end of the inputs... it displays nullpointerexception... its the first time i've encountered this and i just want to know... because i don't know how to handle a nullPointer exception... thanks in advance!!!
here it is...
I have not figured out everything you are doing in this program, but I can tell you what your error is.
You have the statement
This code allocates space for an array of a number of class3 objects, but it does not put any objects in that array. Therefore, every one of those slots in class3 is equal to null. When you get to the statement in your merge method that attempts to do a compare on two elements of class3, neither of them have values, and attempting to call the method compareTo() on one of them fails.
If you mean to copy class1 and class2 elements into class3, you need other statements to do that.
Now, about null pointer exceptions -- they mean very much what they sound like. When you dereference an object reference (which is the technical term for putting a period after it and referring to one of its properties, variables, or methods), that object reference must exist. If it is equal to null, then the runtime has no idea what to do with that reference, and throws a null pointer exception. If you have not trapped null pointer exceptions in an enclosing scope, the program ends.
Joined: Dec 10, 2010
i think i get what you're saying.... so i will try it... A great many thanks!!!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com