D
Draucia
Guest
I just started on java, and I'm learning from this book for dummies. I wanted to see what I learned, so I am doing a sample project. It's about a guy named Bob and Jack having a conversation.
Jack.java~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Bob~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
When I run it, it says "Hello, my name is... Nice to meet you jack."
I want to put a empty line space so the text isn't all in one line. How can I do this? I searched on google, it said something about \n, but It didn't work. Could somebody help me out?
And could somebody tell me if that code is written right?
EDIT: Could somebody tell me how to make it wait for a certain amount of time?
Jack.java~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Code:
public class Jack {
int age;
float weight;
float height;
String color;
public String intro(String aWord){
String introreply = "Jack: Hello, my Name is Jack." + aWord;
return introreply;
}
}
Bob~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Code:
public class Bob {
/**
* @param args
*/
public static void main(String[] args) {
String Introduction = null;
Jack jackreply = new Jack();
jackreply.intro(Introduction);
Introduction = jackreply.intro ("Bob: Nice to Meet you Jack, my name is Bob. ");
System.out.println(Introduction);
// TODO Auto-generated method stub
}
}
When I run it, it says "Hello, my name is... Nice to meet you jack."
I want to put a empty line space so the text isn't all in one line. How can I do this? I searched on google, it said something about \n, but It didn't work. Could somebody help me out?
And could somebody tell me if that code is written right?
EDIT: Could somebody tell me how to make it wait for a certain amount of time?


