Main Page

Previous Next


  1. Write a program to read back and list the contents of the file written by the first exercise in the previous chapter.

  2. Extend the ReadPrimes example that we produced in this chapter to optionally display the nth prime, when n is entered from the keyboard.

  3. Extend the ReadPrimes program further to output a given number of primes, starting at a given number. For example, output 15 primes starting at the 30th. The existing capabilities should be retained.

  4. Write a program that will output the contents of a file to the command line as groups of eight hexadecimal digits with five groups to a line, each group separated from the next by a space.

  5. Write a program that will allow either one or more names and addresses to be entered from the keyboard and appended to a file, or the contents of the file to be read back and output to the command line.

  6. Modify the previous example to store an index to the name and address file in a separate file. The index file should contain each person's second name, plus the position where the corresponding name and address can be found in the name and address file. Provide support for an optional command argument allowing a person's second name to be entered. When the command line argument is present, the program should then find the name and address and output it to the command line.

Previous Next
JavaScript Editor Java Tutorials Free JavaScript Editor