Skip to main content
University of Texas at Austin
University Interscholastic League Logo
University Interscholastic League Logo

Computer Science Resources

Useful Links

IDEs

  • The Eclipse IDE (Interactive Development Environment)
  • The BlueJ IDE
  • The JCreator IDE
  • TextPad, not really an IDE, is a text editor with some built in programming capabilities for Syntax highlighting and compiling and running Java programs with keyboard shortcuts.

References

Programming Practice Problems 

Teacher Resources and Third Party Practice Materials

Other Contests

  • The American Computer Science League
  • Best of Texas Contest a distributed contest run over a period of several weeks.
  • HP CodeWars, one of the largest one day programming contests in Texas.
  • Top Coder is a site that runs many programming contests. Registration required. The practice rooms are especially useful.  Top Coder has a high school specific contest. See the link for more details.
  • USACO, The USA Computing Olympiad. The USACO holds six Internet Contests during the academic year, and in the late Spring conducts the US Open, a proctored exam.

A Note on Reading From Files

The Scanner class is a member of the Java Standard Library beginning in version 5.0.

Here is a discussion about the ins and outs of using the Scanner class to solve problem number 2 from the 2004 regional programming contest.

  • Scanner is in the util package, not the lang package so you need to include the line
     import.util.Scanner;

       at the top of the class

  • To create a Scanner object and connect it to a file you must create a File object based on the name of that file. This can be done with one line;

        Scanner s = new Scanner( new File("scores.dat"));

       Remember all programs are judged assuming the file is in the same directory as the compiled class file so do not put any path information on the file, just the file name. To use the file class you must include the line

     import.io.File;

       at the top of your program.

  • Unfortunately instantiating a File object can result in in an IOException and this is a checked exception so you either have to use a try-catch block or declare that the method that contains the code that generates the checked exception throws an IOException. In actual programming practice it would be much better to include a try-catch block, but for educational and programming contest purposes it is much easier to simply declare that main throws an IOException. Thus the declaration of the main method looks like this:
     public static void main(String[] args) throws IOException
  • IOException must also be imported. This can either be done as a separate import statement:
     import java.io.IOException;

      or since the program now needs multiple classes from the io package we can use the wildcard import. Again, not the best programming practice, but for contests, not a bad idea.

     import java.io.*;

Here is problem 2 from the 2004 regional programming portion of the contest solved using the Scanner class.

import java.util.Scanner;
import java.io.File;
import java.io.IOException;

public class scoresScanner
{
    public static void main(String[] args) throws IOException
    {   String name;
        int score;
        Scanner s = new Scanner(new File("scores.dat"));
       
        final int NUM_LINES = 5;
       
        for(int i = 0; i < NUM_LINES; i++)
        {   score = s.nextInt();
            name = s.next();
           
            System.out.println(name + " " + score);
        }
    }
}