hey guys i am getting frustrated about this work,i am getting error like this
Exception in thread "main" java.lang.NullPointerException
at Game.<init>(Game.java:21)
at Bullclia.main(Bullclia.java:6)
any reason why i am getting this?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
hey guys i am getting frustrated about this work,i am getting error like this
Exception in thread "main" java.lang.NullPointerException
at Game.<init>(Game.java:21)
at Bullclia.main(Bullclia.java:6)
any reason why i am getting this?
There is a variable with a null value on line 21. Look at line 21 in the your source and see what variable is null. Then backtrack in the code to see why that variable does not have a valid value.Exception in thread "main" java.lang.NullPointerException
at Game.<init>(Game.java:21)
If you can not tell which variable it is, add a println just before line 21 and print out the values of all the variables on that line.
If you don't understand my answer, don't ignore it, ask a question.
i have assigemenet to do if you can help me with,
i have an class called Choice and it has constructor which takes array and store it in his array(attribute in Choice class)
,i have an game class which need to have an array of 5040 cells of Choice,and i need to store it with numbers from 1 to 9999 with deference digits(Which combines all to 5040 numbers)
i am getting stucked at this
at first i do
1. Choice [] carray;
2. and i do a loop of 9999 times to check with if's for the numbers i need when i find number like 0123,i store it in array(xarr)
3. carray[0]=new Choice(xarr);
i am getting error at line 3 its not working for :S
Please copy the full text of the error message and post it here.i am getting error at line 3
BTW an array with 5040 slots can not hold 9999 values. It can only hold one value per slot: 5040 max
If you don't understand my answer, don't ignore it, ask a question.
Post the code and the full text of the error message with your question
i figured out my problems but i donot know how to solve it like i explained here i have to do
i have class called Choice ,it has constructor which takes array and store it in his array attribute!
i have game class,which consists an array of 5040 cells of Choice objects,and i need to store in this array number with deference digits,i got 9999 numbers which only 5040 number has different digits in it,like 0123,4567,3451 and etc..
i need to know how to write the array of 5040 in game attribute and how do i store numbers in his array cells lke(0123) ?
seems if i put
Choice[] arr=new Choice[5040]; i am getting an error how do i do it?
Please copy the full text of the error message and paste it here.i am getting an error
If you don't understand my answer, don't ignore it, ask a question.
its k i solved it
Please mark this thread as solved. See Thread tools at top
If you don't understand my answer, don't ignore it, ask a question.