How do I check if string contains \\n or new line character ?
word.contains(\"\\\\n\") word.contains(\"\\n\")
For portability, you really should do something like this:
public static final String NEW_LINE = System.getProperty("line.separator") . . . word.contains(NEW_LINE);
unless you're absolutely certain that "\n" is what you want.
"\n"