CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009
    Posts
    7

    TreeSort Error, "Cannot find Symbol"

    I have this program that I am working on that I am trying to insert user entered integers till a "-1" is detected and it will stop inserting the integers into the Tree and print it out inOrder.

    I am geting 2 errors:

    File: S:\makeup1.java [line: 9]
    Error: S:\makeup1.java:9: cannot find symbol
    symbol : class Tree
    location: class makeup1

    File: S:\makeup1.java [line: 9]
    Error: S:\makeup1.java:9: cannot find symbol
    symbol : class Tree
    location: class makeup1

    Code:
    import java.util.Scanner;
    import java.io.*;
    
    public class makeup1{
      
        public static void main(String [] args){
        
        int n;
        Tree t = new Tree();
        Scanner scanner = new Scanner(System.in);
        
        while(n!=-1){
          System.out.println("input integer into tree: ");
          n = scanner.nextInt();
          insert(t,n);
        }
       
      }
       public static class tree{
        public int value;
        public tree right;
        public tree left;
        public tree(int V, tree L, tree R){
          {
            value = V;
            left = L;
            right = R;
          }
        }
      }
       
       public static tree insert(tree t, int i){
         if(t==null){
          return null; 
         }
         if(t.left!=null){
           insert(t.left, i);
         }
         else if(t.right!=null){
           insert(t.right, i);
         }
       }
       public static tree treesort(tree t){
         if(t==null){
           return null;
         }
         if(!(t.left==null)){
           return t.left;
         }
         return t.right;
       }
    
    }
    Can anyone help me out?

  2. #2
    Join Date
    Nov 2009
    Posts
    17

    Re: TreeSort Error, "Cannot find Symbol"

    Capitalization matters in Java

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured