0

I'm receiving a "can not resolve symbol "left/right" " within my code and i do not fully understand why. I have looked at other examples and posts but am just not fully understanding what i need to do to fix my error. i will post the sections of my code that are relevant to the issue. Any help with this would be greatly appreciated. Thank you. **( i apologize if the appearance is a bit off. the spacing seems to be a little off when i cut and pasted it in)

public class SBST <Value>
{
    private class Node
    {
        private Node left;
        private Node right;
        private String key;
        private Value value;
        public Node(Node left,Node right, String key, Value value)
        {
            this.left = left;
            this.right = right;
            this.key =  key;
            this.value = value;
        }
    }

private Node root;
private int size;
private String [] keys;
private Value [] values;
private int currentSize;
private Random rand = new Random();

public SBST (int size)
{
    if (size < 0)
    {
        throw new IllegalArgumentException();
    }
    else
    {
        this.size = size;
        this.keys = new String[size];
        this.values = new Value[size];
        this.currentSize = 0;
    }
}

public int height(String keys)
{
    if (keys == null)
    {
        return 0;
    }
    else
    {
        int l = height(keys.left);
        int r = height(keys.right);
        if (l > r )
        {
            return l +1;
        }
        else
        {
            return r + 1;
        }
    }
}
nhouser9
  • 6,730
  • 3
  • 21
  • 42
Doom3030
  • 25
  • 1
  • 6
  • 3
    _i apologize if the appearance is a bit off_ Please make an effort to read the help center which explains how to format your code. – Savior Apr 26 '16 at 17:45
  • 1
    Possible duplicate of [What does a "Cannot find symbol" compilation error mean?](http://stackoverflow.com/questions/25706216/what-does-a-cannot-find-symbol-compilation-error-mean) – Savior Apr 26 '16 at 17:47
  • ok thank you and i apologize i am fairly new to posting on this – Doom3030 Apr 26 '16 at 17:47
  • 1
    `keys` is a `String[]`. The `String[]` type does not have accessible `left` and `right` instance members. – Savior Apr 26 '16 at 17:47
  • ok i see the problem now. thank you. – Doom3030 Apr 26 '16 at 17:51
  • @Pillar Can you post your comment as an answer, so it can be accepted? – m0j0hn Jul 24 '17 at 16:18

0 Answers0