The below mentioned code i have written for exception handling. I am accepting three parameters from cmd that two integer values and third is operator if the first two argument are operator then i must generate exception, but when i am putting it into if condition as if (arg[0] == "+") its not actually checking it. Please tell me how to check this condition .


class IllegalArgument extends Exception
{
String str = "";
IllegalArgument()
{
str = "Argument must be in order of int, int, operator";
}

public String toString()
{
return str;
}
}

class IllegalOperation extends Exception
{
String str = "";
IllegalOperation()
{
str = "Operator should +,-,/,*";
}

public String toString()
{
return str;
}
}

class Negative extends Exception
{
String str = "";
Negative()
{
str = "Answer is negative";
}

public String toString()
{
return str;
}
}

class ZeroException extends Exception
{
String str = "";
ZeroException()
{
str = "Answer is Zero";
}

public String toString()
{
return str;
}
}

class OperatorTest
{
public static void main(String arg[])
{
int ans = 0;
// int a = Integer.parseInt(arg[0]);
// int b = Integer.parseInt(arg[1]);
String c = arg[2];

/* System.out.println(a + c + b);
if (c == "+")
{
ans = a + b;

}
if (c == "-")
{
ans = a - b;
}
if (c == "*")
{
ans = a * b;
}
if (c == "/")
{
ans = a / b;
}*/

try
{
if (arg[0] == "+" || arg[0] == "-" || arg[0] == "/" || arg[0] == "*" || arg[1] == "+" || arg[1] == "-" || arg[1] == "/" || arg[1] == "*" )
{
throw new IllegalArgument();
}
}
catch (IllegalArgument e)
{
System.out.println(e);
}

try
{
if (c != "+" || c != "-" || c != "/" || c != "*")
{
throw new IllegalOperation();
}
}
catch (IllegalOperation e)
{
System.out.println(e);
}

try
{
if (ans == 0)
{
throw new ZeroException();
}
}
catch (ZeroException e)
{
System.out.println(e);
}

try
{
throw new Exception();
}
catch(Exception e)
{
System.out.println(e);
}


}
}