Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not getting howdy and folks in the new line, string related from scjp6.0 book

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i anm not getting howday and folks in the new line but special charecter is being displayed in the notepad in place of \n
 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vishal Hegde wrote:i anm not getting howday and folks in the new line but special charecter is being displayed in the notepad in place of \n

Just tested this. Works fine for me. the two words are on different lines and the second line starts with a space.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could also be an encoding issue--try opening the file with a real editor, or just listing it to the command window.
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notepad requires \r\n as line separators. Only \r or \n results in a little square. Use a proper editor like Notepad++ instead of Notepad. Notepad is just worthless, and shouldn't be used at all unless you have no other choice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic