Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: cannot find symbol - error message

  1. #1
    Member
    Join Date
    Feb 2013
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default cannot find symbol - error message

    Hello,

    I have been trying to figure out why my code won't compile. Any help and advice would be appreciated. Thank you!

    I keep getting the following error message:

    cannot find symbol -- method PrintIn(java.lang.String) with the following line highlighted:
    System.out.printIn("Found " + i + " at " +

    Here is the whole code:

    public class BinarySearch
    {
        public static final int NOT_FOUND = -1;
        public static int binarySearch (Integer[] a, int x)
        {
            int low=0;
            int high = a.length - 1;
            int mid;
            while (low <=high)
            {
                mid = (low + high) / 2;
                if (a[mid].compareTo(x)<0)
                    low = mid + 1;
                else if (a[mid].compareTo(x) > 0)
                    high = mid - 1;
                else
                    return mid;
                }
                return NOT_FOUND;
            }
     
            public static void main(String[] args)
            {
                int SIZE = 8;
                Integer[] a = new Integer[ SIZE ];
                for (int i=0; i<SIZE; i++)
                a[i] = new Integer(i * 2);
                for (int i=0; i<SIZE*2; i++)
                    System.out.printIn("Found " + i + " at " + 
                    binarySearch(a, new Integer(i)));
        }
    }


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: cannot find symbol - error message

    So frustrating. The line below should be a lower-case 'L' as in 'line' rather than a capital 'I' as in "Inches." Writing your code in a font that clearly shows the differences is helpful.

    System.out.printIn("Found " + i + " at " +

  3. #3
    Member
    Join Date
    Feb 2013
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: cannot find symbol - error message

    Works perfectly! Thank you so much for your help!

Similar Threads

  1. Error:Cannot find Symbol
    By Leonardo1143 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 13th, 2013, 06:40 PM
  2. Cannot find symbol ERROR
    By yacek in forum What's Wrong With My Code?
    Replies: 8
    Last Post: October 21st, 2011, 11:39 PM
  3. error :cannot find symbol
    By iswan in forum AWT / Java Swing
    Replies: 1
    Last Post: October 1st, 2011, 08:26 AM
  4. Cannot find symbol error
    By AnuR in forum What's Wrong With My Code?
    Replies: 9
    Last Post: February 23rd, 2011, 02:50 PM
  5. cannot find symbol Error
    By bananasplitkids in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 9th, 2010, 02:36 AM