All Questions
156 questions
0
votes
0
answers
32
views
Driver keeps saying "cannot read the array length because "this.grades" is null [duplicate]
Here is the class I am calling in the driver:
public class CourseGrades{
private final int NUMBER_OF_GRADES = 4;
private GradedActivity[] grades;
public CourseGrades(){
}
public void setLab(...
1
vote
2
answers
140
views
Java: Best practice/Design pattern for handling NULL cases on variables that SHOULD NEVER be NULL?
I asked everyone and generally have gotten different responses from everyone.
Now, having a variable that could be NULL in, say, Java, requires to handle that case generally speaking. We can do ...
0
votes
0
answers
64
views
IllegalArgumentException not sure if I wrote the array right
gamePanel gp;
Tile[] tile;
public tileManager(gamePanel gp){
this.gp = gp;
tile = new Tile[10]; // this means we're going to create 10 types of tiles (water, grass, water, sand,...
1
vote
1
answer
2k
views
Unidentifiable nullPointerException and 'Exception in thread "JavaFX Application Thread"'
I'm currently working on a JavaFX project to read data from a file containing information regarding various scenes from a play. I'm trying to display said information on the next scene, but before I ...
0
votes
1
answer
371
views
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException ? Please help I don't know what to do [duplicate]
this is my code an di get this error, I don't understand why, I tried multiple times to figure it out what is happening, are you able please to help me. I tried to check the several topic that are ...
0
votes
0
answers
21
views
How do I resolve a null pointer exception in java? [duplicate]
so I am having a problem with null pointer exceptions and can't figure out what is wrong:
so our homework task was to implement our own version of a stack by extending vector. This is what I got:
...
1
vote
1
answer
41k
views
Exception in "main"java.lang.NullPointerException:Cannot invoke "java.lang.Integer.intValue()"the return value of "java.util.Map.get(Object)" is null [duplicate]
I'm having trouble with this code. I copied this code from the book.. What is the problem??
import java.io.*;
import java.util.*;
public class WordCount {
// minimum number of occurrences needed ...
0
votes
2
answers
51
views
Null pointer Exception erorr while running, but Why? [duplicate]
public class Student {
int[] mark ;
char[] grade;
public int[] getMark() {
return mark;
}
public void setMark(int[] mark) {
this.mark = mark;
}
public char[] getGrade() {
return grade;
}
...
0
votes
1
answer
73
views
Why is o.pet null even though I set it to be a value?
I'm doing an apcs project on a RescueCenter where people can adopt animals and more. The problem I'm encountering is that in my UI, when I try to list the pets of the selected owner, an exception ...
1
vote
0
answers
12
views
Android development, how to change the value of a customized class's member when the controller button is pressed [duplicate]
IDE: Android Studio
I want to write a program that when a user pressed down the KEYCODE_DPAD_UP button(like the up button on an Xbox One controller), the value of a member variable of a customized ...
0
votes
4
answers
206
views
How to check whether value is not present or just has no value?
I am new to Java and Optional. Here I have an unsorted array of primes.
List<Integer> primes = Arrays.asList(3, 7, 5, 2, 13, 11);
int getPrime()
{
primes.sort(); //using Comparator
return (...
0
votes
0
answers
20
views
I am new to android development. Trying to create app with 3 activity. Error message: Exception raised during rendering [duplicate]
java.lang.NullPointerException
at android.content.res.Resources_Delegate.getDrawable(Resources_Delegate.java:189)
at android.content.res.Resources.getDrawable(Resources.java:845)
at ...
0
votes
1
answer
22
views
Why is my TextView null, altough im getting the values from the Database?
I wanted to get the comments for my social network app from the database and show it on a recycler view but the text where the comment should be is null
and i dont know why.
//The Database Reference
...
0
votes
1
answer
95
views
NoSuchFileException error while executing jar file
I coded up a method which reads a text file, when I run it it works, but when I execute the jar, I get the NoSuchFileException error.
Here is my code:
private static final String textFile = "textFile....
0
votes
2
answers
132
views
Returning Null vs Exception vs Contract
What would be considered an acceptable way of dealing with returning a record from a DB with the following 3 potential outcomes:
Db connection works, finds a user and returns a populated user object
...