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 8379533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:12:56+00:00 2026-06-09T16:12:56+00:00

I’m trying to compile the following code: package week1; public class ThreeSum { public

  • 0

I’m trying to compile the following code:

package week1;

public class ThreeSum {
    public static int count(int[] a) {
        // count triples that sum to 0
        int count = 0;
        for (int i = 0; i<a.length; i++) {
            for (int j = i+1; j < a.length; j++) {
                for (int k = j+1; k < a.length; k++) {
                    if (a[i] + a[j] + a[k] == 0) {
                        count++;
                    }
                }
            }
        }
        return count;
    }

    public static void main(String[] args) {
        int[] a = In.readInts(args[0]);
        StdOut.println(count(a));
    }
}

This code is in the ThreeSum.java file in week1 folder. Both classes “In” and “StdOut” are in the package stdlib.jar which is in the ./lib folder.
I’ve always used an IDE and now decided to use a command line. So on my

javac -cp .:lib/stdlib.jar week1/ThreeSum.java

and other variants of classpath parameters it returns an error:

week1\ThreeSum.java:20: error: cannot find symbol
        int[] a = In.readInts(args[0]);
                  ^
  symbol:   variable In
  location: class ThreeSum

week1\ThreeSum.java:21: error: cannot find symbol
        StdOut.println(count(a));
        ^
  symbol:   variable StdOut
  location: class ThreeSum

How a proper -cp option should look like in my case?

  • 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-06-09T16:12:58+00:00Added an answer on June 9, 2026 at 4:12 pm

    What are In and StdOut? There are no such classes in the JDK. You do have System.in and System.out. Please see the Java docs.

    There’s no readInts() method on System.in. Perhaps you mean some custom classes of your own.

    Write it like this and forget about that JAR dependency:

    package week1;
    
    /**
     * ThreeSum
     * @author mduffy
     * @since 8/14/12 1:53 PM
     * @link http://stackoverflow.com/questions/11950145/cant-correctly-setup-classpath#comment15924351_11950145
     */
    public class ThreeSum {
        public static int count(int[] a) {
            // count triples that sum to 0
            int count = 0;
            for (int i = 0; i<a.length; i++) {
                for (int j = i+1; j < a.length; j++) {
                    for (int k = j+1; k < a.length; k++) {
                        if (a[i] + a[j] + a[k] == 0) {
                            count++;
                        }
                    }
                }
            }
            return count;
        }
    
        public static void main(String[] args) {
            int[] values = new int[args.length];
            int valuesCount = 0;
            for (String arg : args) {
                int value = Integer.valueOf(arg);
                values[valuesCount++] = value;
            }
            System.out.println(String.format("count: %d", count(values)));
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I'm trying to create an if statement in PHP that prevents a single post
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.