I have a StringBuilder object,
StringBuilder result = new StringBuilder(); result.append(someChar);
Now I want to append a newline characte
It should be
r.append("\n");
But I recommend you to do as below,
r.append(System.getProperty("line.separator"));
System.getProperty("line.separator") gives you system-dependent newline in java. Also from Java 7 there's a method that returns the value directly: System.lineSeparator()
System.getProperty("line.separator")