I have a relatively simple console output for debug purposes as I'm trying to figure out an error not connected to this issue. My code is the following:
System.out.println("info: " + element + " || " + getIDforName(element));
The variable element
of type String is taken from a cmd output and might me empty/null. I would therefore expect it to output something like info: null || null
. However it does not do that but outputs this: || null
which is really puzzling my.
I'd unterstand if it wouldn't write it completely for some reason or if it would write info: ||
but the actual output makes no sense to me as it can't just skip a part.
So my question is: Why does this happen and how do I fix it? If any additional code is needed I'll try to provide it.
EDIT: getIDforName(String name) is a method which compares some Strings and returns a String if there is a matching one.