This is the Message Centre for Courtesy38

Java

Post 1

Good Doctor Zomnker (This must be Tuesday," said GDZ to himself, sinking low over his Dr. Pepper, "I never could get the hang of Tuesdays.")

Hey courtesy, I understand you know java. I am just learning it and need a little assistance with how to write an if-then-else statement. Can you help me?


Java

Post 2

Courtesy38

Sure, always glad to help.

First I HIGHLY recommend the online (free) book, by Bruce Eckel, entitled Thinking in Java, you can find it by going to bruceeckel.com

Now to the statement, it goes as follows:

if (<test&gtsmiley - winkeye {
;
}
else {
;
}

You can also add any number of else if (<test&gtsmiley - winkeye {} checks between if and the else.

Hope this helped.

Courtesy


Java

Post 3

Good Doctor Zomnker (This must be Tuesday," said GDZ to himself, sinking low over his Dr. Pepper, "I never could get the hang of Tuesdays.")

That did help, thanks.

Have run into another issue though.

OutputFile answerFile;
answerFile = new OutputFile("c:\\documents and settings\\Ben\\My Documents\\School\\1st Semester Summer 2005\\CIS 1030\\answers.txt");
answerFile=("c:\\documents and settings\\Ben\\My Documents\\School\\1st Semester Summer 2005\\CIS 1030\\answers.txt");

The third line in there is giving me an incompatible type error. It says it found java.lang.String and requires Programs.OutputFile, I've got all my method calls in the same folder and am not having any problems with any of the other method calls.


Java

Post 4

Courtesy38

Okay, so you defined answerFile as an OutputFile type. However if you look at the third line, you are telling answerFile to be equal the string value you have next to it.

After you define answerFile as a new OutputFile all you have to do is reference answerFile.

Courtesy


Key: Complain about this post

More Conversations for Courtesy38

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more