String.split
uses a regular expression so you need to escape the pipe |
, which is a special character (meaning OR):
String args[] = line.split("\\|");
Also to print the String
array output rather the Object.toString
representation, you will need:
System.out.println(Arrays.toString(candidatArgs));