Write a program that displays your name and address on the screen as if it were a letter. Your output should look something like that below.
U:\>java LetterToYourself +---------------------------------------------------------+ | #### | | #### | | #### | | | | | | Bill Gates | | 1 Microsoft Way | | Redmond, WA 98104 | | | +---------------------------------------------------------+
|
to show up on the screen?|
character is called a "pipe". Assuming you are using
a normal US keyboard, it is Shift + backslash (\
). The backslash
key is usually located between the Backspace and Enter keys.You probably used a mixture of tabs and spaces between the
quotes in your println()
statements. Many text editors / IDEs
will only move the cursor 4 spaces when you press TAB. But when your
program runs, any tabs embedded inside the quotes will take up 8 spaces, not 4.
If you delete ALL the tabs between the quotes and replace them with spaces, things
should look the same in your code and when you run the program.
(Most good text editors have an option to show visible whitespace,
which can make it easier to fix this. For example, JCreator has a
"Show Whitespace" option in the "View" menu, which will display
spaces in your code with a small dot like ⋅
and will display tabs with a little double bracket like
»
.)
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.