The code is too big to paste the entire when i am having one error at Line 20 that says:
"cannot make static reference to non-static Integer"
I'm use to C but so I'm not use to having to putting the word static in places.

private static void createTree(){
		ArrayList arrayOfInts = new ArrayList();
		
	
		T t = new T();
		TreeNode root = t.getRoot();
		
		System.out.println("Please enter a list of integers:");
	
		
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String result = null;

		
		try {
		
			while((result = in.readLine()) !=null)
			{
				Integer intResult = Integer.parseInt(result); //error: cannot make static reference to non-static Integer
			//	Integer intResult = result;  //error: cannot make static reference to non-static Integer
			    System.out.println("intResult:"+intResult);
			//	insertInOrder(root, intResult);
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		//this means your done inputing. 
		//this means your done inputing. 
	}
	
	/**
	 * Instantiates a new t.
	 */
	public T()
	{
		super();
		root = new TreeNode();
	}

You can't reference a non static class variable from a static method. The class varible only exists in created objects (ie with new).
Why does the code want to see a variable belonging to an object when there is no object?
If the variable is static then there is only one of it available to everyone.

No, that can't be it because I already tried using the primitive type int and that had the same error:
int intResult = result; //error: cannot make static reference to non-static Integer

But also tried it like you said and put new Integer but I still get the same error:
Integer intResult = new Integer.parseInt(result); //error: cannot make static reference to non-static Integer

Please write a SHORT program to demo the problem and post it here with the error messages.

The type of the variable is not relevant. Integer vs int would make no difference.

you are trying to make reference to a variable of type string from premitive variable which is not possible. declare your variable "result" as int.

This article has been dead for over six months. Start a new discussion instead.