Reputation: 1679
System.lineSeparator()
is not available when I am doing my Android development. I had to use the older version System.getProperty("line.separator")
instead.
Can anyone explain to me why is that? Is it because the Android SDK is not using Java 7?
Upvotes: 7
Views: 8005
Reputation: 2390
Yes, System.lineSeparator()
this is a JAVA 1.7 feature.
System.getProperty("line.separator")
is the correct way to do it pre 1.7
There is an open bug on the oracle site where System.lineSeparator()
has not been marked with @Since 1.7.
https://bugs.java.com/bugdatabase/view_bug?bug_id=7094275
"The new static method lineSeparator() on java.lang.System class is new in java 1.7, so should have the @since 1.7 annotation present in the javadoc."
Upvotes: 22