The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

what a joke

Posted by me on May 17, 2001 at 7:16 AM


ha ha ha ha ha ha


> This is a race, whoever can respond to it faster is the winner.

> Create a simple java program...here is the program:

> Write a program called Find that searches all files specified on the command line and prints out all lines containing a keyword. For example, if you call

> java Find Buff report.txt address.txt Homework.java

> then the program might print

> report.txt: Buffet style lunch will be available at the
> address.txt: buffet, warren | 11801 Trenton Court |
> Homework.java: BufferedReader in

> The keyword is always the first command line arguement.

> Your program should not crash (i.e. generate an unhandled exception), regardless.
> Your program should consider the first command-line input to be the search string, regardless of its format.
> Your program should emit an error message for any file that it can't open, and continue with the next file given in the command line.
> Your program should print a "usage" line if the command-line input is insufficient to allow the program to run.
> Your program may search in a case insensitive or case sensitive way, I don't care.
> Your program should find ALL substring matches, not just whole words.
> Your program should print each line of a file in which it finds a match in its entirety, but should only print such a line once, even if there are multiple matches in the line.






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us