In my main method I have the code..
String FactoredForm = FactoredForm.getFF(gcd1, gcd2, a, hii);
And the FactoredForm class is:
public class FactoredForm {
public static String forName(int l, int o, int a, int hii) {
// (lx+o)(mx+p
String FF1, FF2;
if (o > 0){
FF1 = ("(" + l + "x+" + o + ")");
}
else{
FF1 = ("(" + l + "x" + o + ")");
}
if (hii/o > 0){
FF2 = ("(" + a/l + "x+" + hii/o + ")");
}
else{
FF2 = ("(" + a/l + "x" + hii/o + ")");
}
String FactoredForm = (FF1+FF2);
return FactoredForm;
}
}
I get the error that the method getFF is undefined for the type String. Am I missing something?
You can’t have the String name same as the class name. That’s causing the error.