0

write a program that displays the following information, each on a separate line:

  • your name
  • your address, with city, state and ZIP
  • your telephone number
    your college major

    Although these items should be displayed on separate output lines, use only a single println statement in your program.

4
Contributors
4
Replies
19
Views
1 Year
Discussion Span
Last Post by Reverend Jim
2

So something like this?

public class HelloWorld{

    public static String newline = System.getProperty("line.separator");
     public static void main(String []args){
        String me = "your name" + newline
                            +"your address" + newline
                            +"city, state and ZIP" + newline
                            +"your telephone number" + newline
                            +"your college major";
        System.out.println(me);
     }
}
Votes + Comments
Genius.
0

I've a horrible feeling that that was all he was asking for (although a simple \n would have been sufficient).

Yash : we don't do people's homework for them, but we will help people to do it themselves. It's up to you.

0

It's been kicked around if \n would do. Think of other OSes and this covers them all. Just in case. So much left unasked by Yash. Seems too much like Hello World with well, what you see.

Something I've seen forever is poor specs. Seems odd that you would want just to print out one item like that.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.