Java.. need help
Posted: September 18, 2004, 6:11 pm
Ok. Taking a once a week college course, programming 1, using Java.My professor cannot explain many things well, and the books he's given us could have been nuke physics books in a previous life.
I've asked him about other books and the like to use as suplementary items. He can't recommend any, somthing about it may contradict the method he's been teaching or may use a different kind of java code to work with.
That being said, I think he's full of shit about the previous statement and I need help. ><
Type of programs we're writing include this gem that's straight out of my lab book. Any advice as towards a publication (book, website) that can help would be more than appericated.
[/code]
I've asked him about other books and the like to use as suplementary items. He can't recommend any, somthing about it may contradict the method he's been teaching or may use a different kind of java code to work with.
That being said, I think he's full of shit about the previous statement and I need help. ><
Type of programs we're writing include this gem that's straight out of my lab book. Any advice as towards a publication (book, website) that can help would be more than appericated.
Code: Select all
import java.io.*;
public class TestMessage
{
static class Message
{
String name;
String message ;
BufferedReader in;
// Class methods follow.
public void getName() throws IOException
{
in = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter name:");
name = in.readLine();
}
public void getMessage() throws IOException
{
System.out.println("Enter message:");
message = in.readLine();
}
public static void main(String [] args) throws IOException
{
Message text;
text = newName;
text.getName();
text.getMessage();
text.printMessage();
}
public void printMessage()
{
System.out.println("Hello " + name);
System.out.println(message);
}
}
}