Re: Please Help, Urgent!!!!!!!
From: Scott Ellsworth (scott_at_alodar.com)
Date: 03/29/04
- Next message: neu: "jar on jdk1.3.1 save only class files?"
- Previous message: Jon A. Cruz: "Re: appending paths"
- In reply to: Michael Lavia: "Please Help, Urgent!!!!!!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Mar 2004 10:05:59 -0800
In article <cfca99bf.0403281933.223eca3@posting.google.com>,
mlavia@yahoo.com (Michael Lavia) wrote:
Given that you were obvious about the source of the problem, and did put
something together, I will throw one hint your way. For more hints, try
to identify one large scale problem, such as a compiler error message
you do not understand. Read the FAQ and a good java book, and if you do
not get it, post.
> Here is my code so far, and it is wrong....but i need to get this
> done, please help:
Again - be very specific about what is wrong with it, and your guess as
to why.
>
> class StringRead {
>
> public static void main(String[] args) {
>
> int decWords = 0;
> int[] decWords = new int[12];
> BufferedReader = dcl;
I bet you are getting a "dcl not defined here" error, or some other
syntax error. Try:
BufferedReader dcl;
BufferedWriter writer;
StringTokenizer st;
> BufferedWriter = writer;
> StringTokenizer = st;
> String line;
>
> dcl = new BufferedReader(new FileReader(new File
> "Declaration.txt"));
Are you getting some message about an uncaught exception? Look up
try/catch.
> writer = new BufferedWriter(new FileWriter(new
> File(decWords[12])));
Describe really simply what this line is intended to do, and what it
works on, and you should be able to see the problem. Hint: a File
demands a string containing the name of the file to open, and you have
sent it an integer.
> st = new StringTokenizer(dcl);
> while ((line = reader.readLine()) != null) {
Shouldn't you be using the string tokenizer here? Perhaps you want to
grab the next token and see how long it is.
> writer.write(line);
I doubt you want to just copy the file, which is what this appears to
do. It seems more likely that you want to examine a word, see what
length it is, increment the appropriate entry in the array, and then
print out that array when it is all over.
> writer.newLine();
> }
> reader.close();
> writer.close();
> }
> }
> }
Good luck - check the FAQ and a good book, and have at it.
Scott
-- scott@alodar.com Java and database consulting for the biotech community
- Next message: neu: "jar on jdk1.3.1 save only class files?"
- Previous message: Jon A. Cruz: "Re: appending paths"
- In reply to: Michael Lavia: "Please Help, Urgent!!!!!!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|