Verwenden Sie stattdessen 'System.getProperty( "line.separator" )'.
public static void main( String[] args) {
FileWriter fw = null;
try {
fw = new FileWriter( "LineSeparators.txt" );
fw.write( "Hello World!" );
fw.write( System.getProperty( "line.separator" ) );
}catch (Exception e){
e.printStackTrace();
} finally {
if ( fw != null ) {
try { fw.close(); } catch ( Exception e ) {}
}
}
}
|
|