Java uses String constant with quotes

When I compare this constant string with MV inside with a variable with MV inside the result, it is a lie. The string constant looks like "MB" ([", M, B,"] = 4 length), and my variable is MB (length [M, B] = 2). What is wrong here. Java cannot put quotation marks inside code in a string.

string constant

Var 2

public static final String gc_TelCodeFixed = "FX"; if (!telcode.getId().equals(com.quoka.qis.db.constant.Constants.gc_TelCodeFixed)) throw new TelcodeTypeMismatchException(telcode.getType()); 
+6
source share
1 answer

Invisible characters can cause this behavior.

How did "MB" appear? did you type them or copy them to another program? The copy-paste operation may end with invisible characters, and text editors will not show them.

This can be easily reproduced by copying from a PDF file using the Linux document viewer.

Hope this helps, Yaron

+1
source

All Articles