Java Looping string replacemnet
<p>I want this part of my code for my calculator and since I am replacing x with the variable I need to made sure something like 2x is 2*x. Why is this code adding a '*' when there is a + in front?<br>
if pLine = "1+x";</p>

<p>Why does it still add a "*"?</p>

<pre><code>for (int j = 0; j &lt; pLine.length(); j++)
    {   
        if (pLine.charAt(j) == 'X' || pLine.charAt(j) == 'x' )
        {
            if(pLine.charAt(j-1) != '+' || pLine.charAt(j-1) != '-' || pLine.charAt(j-1) != '/' || pLine.charAt(j-1) != '*')
                {

                pLine = pLine.substring(0, j) + "*" + pLine.substring(j, pLine.length());
                System.out.println(pLine.substring(0, j));
                break;



                 }
            else
            {

            }


        }

    }
</code></pre>
