Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6249053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:10:08+00:00 2026-05-24T13:10:08+00:00

I am brand new to Java. I am having an issue compiling a basic

  • 0

I am brand new to Java. I am having an issue compiling a basic java program, and I am trying to understand why. (note that the TextIO class in the code is used in book I am studying to simplify the IO process, I don’t believe that is where the issue is) Here is my code:

public class ProcessSales {
    public static void main(String[] args) {

        String      ln;
        String      tmp;
        int         i;
        int         noval;

        TextIO.readFile("sales.dat");

        while (TextIO.eof() == false){
            ln = TextIO.getln();
            for (i = 0; i < ln.length(); i++) {
                if (ln.charAt(i) == ':'){
                    tmp = ln.subString(i + 1);  
                }   
            } // end line for loop

            try {
                System.out.printf("%8.2f\n", Double(tmp.trim()));
            }
            catch (NumberFormatException e) {
                noval++;
            }
        } // end of file while loop

        System.out.printf("\nThere were a total of %d cities that didnt have data\n", noval); 

    } // end of main subroutine
} // end of ProcessSales class

The compile error I get is as follows:

[seldon@PrimeRadiant Exercises]$ javac ProcessSales.java
ProcessSales.java:15: cannot find symbol
symbol  : method subString(int)
location: class java.lang.String
                    tmp = ln.subString(i + 1);  
                            ^
ProcessSales.java:20: cannot find symbol
symbol  : method Double(java.lang.String)
location: class ProcessSales
                System.out.printf("%8.2f\n", Double(tmp.trim()));
                                             ^
2 errors

Ive declared ln as a String object. The subString method is straight out of the java api for a String object. I’m not understanding why I’m getting a cannot find symbol compile error, especially if it lists the method signature and location right below the error.

I marked the questions as homework, since I am working out of a textbook, and I am looking to understand the issue, rather than a flat solution. However it is self study, and not part of any actual class (right now).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:10:09+00:00Added an answer on May 24, 2026 at 1:10 pm

    The great thing about the Java compiler is, it gives you alot of information to use in determining where problems exist in your code. For you, the first problem is here:

    tmp = ln.subString(i + 1);
    

    In this case you capitalized a letter that you shouldn’t have. It should be:

    tmp = ln.substring(i + 1);
    

    Whenever you see compiler output saying ‘cannot find symbol’ its because the Java compiler could not find a method matching the outputted name, either due to a syntax error or missing dependency. For your second problem, you didn’t post the appropriate code, but from the error message I can see you are missing the new keyword.

    System.out.printf("%8.2f\n", Double(tmp.trim()));
    

    Should be

    System.out.printf("%8.2f\n", new Double(tmp.trim()));
    

    If this is not your first programming language then I would recommend using an IDE like Eclipse, as it will give you auto-completion and syntax checking. It’s a great tool for quickly learning the API’s for the language. However if Java is your first programming language please do continue without hand-holding, as the hard knocks will cement in the lessons learned, faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm brand new to MVC and, as a learning exercise, I'm trying to re-write
We are ready to start a brand new project at work, no legacy code.
I am a brand new Java developer (I have been working in asp.net) and
I'm brand new to java, coming from a ruby world. One thing I love
I am brand new to the Java EE world. As an exercise to try
I'm brand-spanking new to Java and I made this little translator for PigLatin. package
I'm brand new at Python and I'm trying to write an extension to an
The brand-new WCF-based code needs (in the meanwhile) to provide a service to a
I am brand new to Jquery and have run into something that if answered
I'm brand new to C and am trying to learn how to take a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.