Strange quote characters around java static string (on android?)

I have a String constant defined in a class:

public static final String ABC = "abc"; 

And I want to compare if the other String is:

 String test = "abc"; if (test.equals(OtherClass.ABC)) { doSomething(); } 

This test strangely fails, and when I check the variables with eclipse, I see that ABC is 2 characters longer than the test and looks like this:

 ABC: "abc" test: abc 

Where do these quotes come from and how can I get rid of them?

+5
source share
1 answer

You are right, it surrounds the value with additional double quotes in quick look.

enter image description here

But when you check the value from the Expresions , that value is true. In addition, it fixes the previous quick preview behavior.

enter image description here

But still, an exit is expected. These two values ​​are equal. I believe that this is a mistake, because this behavior does not make sense to me. Maybe I'm wrong. I do not know if this helped, and if it can be considered as an answer, but I wanted to include screenshots, and the comments do not support this.

The code is not from the android project. Just a simple Java project. I am using eclipse Kepler.

 class OtherClass { public static final String ABC = "abc"; } public class MainJsoup { public static void main(String[] args) throws Exception { String test = "abc"; if (test.equals(OtherClass.ABC)) { System.out.println("They are equal."); } else { System.out.println("They are unequal."); System.out.println("OtherClass.ABC = " + OtherClass.ABC); } } } 
+3
source

Source: https://habr.com/ru/post/1208902/


All Articles