Kayleigh Gilroy wrote:I have tested this code and it seems to work but when I call "method1" from a method in of a different class I get the error message.
Calling that code from another class will not cause a NullPointerException unless the reference you are calling the method with is null. So we would need to see that other code before we can help you.
The full stack trace you get may also be helpful