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