In my program I'm trying to loop specific actions depending on the value of the String args[0]. I have a conditional tree setup, but no matter what args[0] is, it always chooses the last else option as opposed to the option I want it to be.
Here is the relevant code:
public static void main(String[] args)
{
int a = Integer.parseInt(args[1]);
int b = Integer.parseInt(args[2]);
int c = Integer.parseInt(args[3]);
int d = Integer.parseInt(args[4]);
for (int i = -a; i <= a; i++)
{
for (int j = -b; j <= b; j++)
{
for (int k = -c; k <= c; k++)
{
for (int l = -d; l <= d; l++)
{
if (args[0] == "rational-class")
rationalClass(a,b,c,d);
else if (args[0] == "rational-instance")
rationalInstance(a,b,c,d);
else if (args[0] == "complex-class")
complexClass(a,b,c,d);
else if (args[0] == "complex-instance")
complexInstance(a,b,c,d);
else
System.out.println("error");
}
}
}
}
}