The difference is that \n
in the String
literal "asdf...23\n..asd12"
is handled by the Java compiler, a user input asdf...23\n..asd12
is passed to Scanner
it is.
Java escape- \n
(LF), 10 UNICODE. Scanner
, , : '\'
'n'
, , split
, LF.
escape- \n
, , split
, :
String[] i = wanttosplit.split("(?<!\\\\)\\\\n");