***error*** Exception in thread "main" java.lang.NullPointerEx

Posted 03 April 2013 - 08:07 AM

I'm making a simple hangman application. This is the class that will see where the letter is in the word

import java.lang.String;
public class char_array {
main main = new main();
String word; // this will be some word the person would be trying to guess like "brady"
String x; // this is the letter the operator guesses , so it would be like "b"
public char_array(String a, String B)/>{
a = this.word;
b = this.x;
}
public void some_function() {
char charArray[]=word.toCharArray();
for(int h=0;h<charArray.length;h++){
System.out.println("Data at ["+h+"]="+charArray[h]);//this is just to test
}
}
}

this is the error I get

Exception in thread "main" java.lang.NullPointerException
at char_array.some_function(char_array.java:15)
at main.main(main.java:47)