This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
That depends on the requirements. If the String is fixed, i.e. "4718384 California, United States April 2008 " and it's fairly easy. Just take out the "United States" from the original String and append it to the original String and make sure you add the new line before appending it. You can use substring(), StringBuilder class, etc.
But if you want to achieve more than just a fixed String, you need to think further whether there's some pattern to identify that String. [ April 16, 2008: Message edited by: Freddy Wong ]
Joined: Apr 14, 2008
I already broke the state and country apart by using substring already by using the delimitor "," .
I tried adding new line after country and it doesn't work.
System.out.print(state + "\n" + country) but everything after country is on the new line.
Nevermind, I found a way. I used the System.out.println(country) last after everything is printed. [ April 16, 2008: Message edited by: annie roberts ]