I am working on a very simple command line program in Java to test my knowledge of the Chinese writing system. The goal is to present English, Pinyin, or Hanzi and to then force the user to enter the 2 which are not shown. After working through a few simple Array errors, I encountered a NullPointerException.

Now, I understand what it is, I simply can't see why it is occurring.

In the file called Master.java, I have the following:

```
static final String [] [] Mandarray = {{"You", "Nǐ", "你"}, {"Good", "Hǎo", "好"}};

```

In the constructor of my Chinese\_Mandarin object, I copy the contents of this array to a new one, one of the members of the Chinese\_Mandarin object, like so,

```
    public Chinese_Mandarin(char transfer){ 
    if(transfer == 'n' || transfer != 'y')System.exit(0);

    for (int i = (Master.Mandarray.length-1); i>0 ;i--){
        mandalist [i][0] = Master.Mandarray[i][0];
        mandalist [i][1] = Master.Mandarray[i][1];
        mandalist [i][2] = Master.Mandarray[i][2];
    }

```

With the above 'if' part of the system that asks if the user wishes to continue, it is not important.
Next, I check to make sure that the same entry isn't to be shown again by seeing if the first character is \*, which, by my program, indicates the entry has already been used.

```
public void presenter(){
    Scanner chinEngl = new Scanner(System.in);
    restart: for (int i = mandalist.length; i>0 ;i--){
        randInt = random.nextInt(mandalist.length);
        randIntSub = random.nextInt(3);
        if(mandalist[randInt][randIntSub] == ""){
            continue restart;
        }
        else if (((mandalist[randInt][randIntSub]).charAt(0)) == '*'){
            continue restart;
        }

```

Here, I initialize a scanner to be used later, create two random integers to be used later on, and make sure the elements aren't empty (for if they are, I pass to the tag 'restart' to continue looping despite this).

On the line:

```
else if (((mandalist[randInt][randIntSub]).charAt(0)) == '*'){

```

I receive a NullPointerException error, but cannot fathom why... The Master.mandarray has been transferred to mandalist, I can assume (but that's why I am here) and as such there should be no trouble retrieving the first char of a full entry, right?

Is the problem that the system may retrieve a Chinese character and not know how to handle it?
Or is something that I am missing afoot?
Thank you to anyone who may help me. You will surely get credits!