K
Kermit Piper
Hello,
I am trying to output a String that I can pass to another method I
already have set-up that will take this value as an input parameter.
But, I keep getting Type mismatch: cannot convert String ot boolean. I
know it's probably simple but I can't see it. If someone could help I'd
sure appreciate it. Here is the method and a comment by the line where
I'm trying to return a String value:
public static boolean checkUPCFormat4(String temp)
{
if (temp.length() >3 && temp.length()<= 4)
{
if (temp.equalsIgnoreCase("0000"))
{
System.out.println("You have entered an invalid 4-digit UPC Code.
Verify and enter ALL numbers.");
String exceptionString
= new String("UPC should be all Numeric");
return exceptionString; //Type mismatch
return false;
}
return true;
}
return false;
}
Thanks,
KP
I am trying to output a String that I can pass to another method I
already have set-up that will take this value as an input parameter.
But, I keep getting Type mismatch: cannot convert String ot boolean. I
know it's probably simple but I can't see it. If someone could help I'd
sure appreciate it. Here is the method and a comment by the line where
I'm trying to return a String value:
public static boolean checkUPCFormat4(String temp)
{
if (temp.length() >3 && temp.length()<= 4)
{
if (temp.equalsIgnoreCase("0000"))
{
System.out.println("You have entered an invalid 4-digit UPC Code.
Verify and enter ALL numbers.");
String exceptionString
= new String("UPC should be all Numeric");
return exceptionString; //Type mismatch
return false;
}
return true;
}
return false;
}
Thanks,
KP