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 7 of 7

Thread: "cannot find symbol" error when trying to use the getInt() method.

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default "cannot find symbol" error when trying to use the getInt() method.

    I am trying to obtain something from an array and when I compile it tells me "cannot find symbol. "
    public int numberOfAccesses()
        {
            int total = 0;
            int index = 0;
            hourCounts.getInt(hourCounts, 24);
     
     
    ....... hourCounts = new int[24]; //this is how it is declared in the instance field.

    I'm not sure what I am doing wrong, any help would greatly appreciated, thanks.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: "cannot find symbol" error when trying to use the getInt() method.

    "cannot find symbol. "
    Can you post the full text of the error message the shows what can not be found and other important info about the problem.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: "cannot find symbol" error when trying to use the getInt() method.

    Sorry - "cannot find symbol - method getInt(int[],int)"
    I'm trying to write a method that will allow me to access the hourCounts array.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: "cannot find symbol" error when trying to use the getInt() method.

    The compiler can not find a definition for a getInt() method that takes an int array and and int as args defined for the variable: hourCounts. If hourCounts is an array, there is not a getInt() method for arrays.

    What class is getInt() defined in? What is the statement with the error supposed to do?

    trying to write a method
    See the tutorial:
    http://docs.oracle.com/javase/tutori...O/methods.html
    If you don't understand my answer, don't ignore it, ask a question.

  5. The Following User Says Thank You to Norm For This Useful Post:

    simpson_121919 (February 21st, 2013)

  6. #5
    Junior Member
    Join Date
    Feb 2013
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: "cannot find symbol" error when trying to use the getInt() method.

    Oh I was mistaken the Array class for the Arrays class. After looking into the arrays class I tried doing a binarySearch() and got the same error. All I was trying to do was access info from an index in my array. I have had no problems with retrieving data from an arraylist but using the an array is confusing me. Thanks for the quick replys.

  7. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: "cannot find symbol" error when trying to use the getInt() method.

    using the an array is confusing
    You access an array by using the name of the array, some [] and an index value:
    theArray[theIndex] // access the element at theIndex in theArray
    If you don't understand my answer, don't ignore it, ask a question.

  8. #7
    Junior Member
    Join Date
    Feb 2013
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: "cannot find symbol" error when trying to use the getInt() method.

    It turns out it is an ArrayType Class. I have so much to learn. Thanks for the help.

Similar Threads

  1. Replies: 3
    Last Post: January 22nd, 2013, 07:14 AM
  2. ERROR - "CANNOT FIND SYMBOL"
    By abinaya.cs in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 18th, 2013, 07:07 AM
  3. Please! Help me to this error "ERROR CANNOT FIND SYMBOL"
    By mharck in forum Object Oriented Programming
    Replies: 8
    Last Post: July 3rd, 2012, 09:20 AM
  4. "Cannot find symbol" compilation error
    By collegejavastudent in forum What's Wrong With My Code?
    Replies: 7
    Last Post: December 12th, 2011, 05:07 PM
  5. Replies: 7
    Last Post: August 13th, 2011, 01:22 AM