I have string like
"I am a boy".
I want to print like this way
"I
am
a
boy".
Can anybody help me?
System.out.println("I\nam\na\nboy");
System.out.println("I am a boy".replaceAll("\\s+","\n"));
System.out.println("I am a boy".replaceAll("\\s+",System.getProperty("line.separator"))); // portable way