Link to home
Start Free TrialLog in
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

asked on

Strange if, if else execution

Hi,

I'm not sure why this if/else statement is skipping over my first case. I have a string with the contents:

     "nearestneighbor"

then the code that checks it:

                if (strCode == "nearestneighbor")
                {
                    System.out.println("using nn");
                    m_ImageQuality = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
                }
                else if (strCode == "bilinear")
                {
                    System.out.println("using bilinear");
                    m_ImageQuality = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
                }
                else if (strCode == "bicubic")
                {
                    System.out.println("using bicubic");
                    m_ImageQuality = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
                }
                System.out.println("The value of strCode was [" + strCode + "].");

Now it doesn't enter the first if block, which I think it should. The print out at the end of the cases verifies the contents, here's what's printed out:


    The value of strCode was [nearestneighbor].

I must be missing something really silly, why is it not matching?

Thanks

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial