Java if statement won't work.

Caporegime
Joined
12 Mar 2004
Posts
29,962
Location
England
Code:
if ((name.charAt(i)).isDigit())

Keep getting this error message

Code:
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 9 in the jsp file: /Demo 2/mypage.jsp
Generated servlet error:
Cannot invoke isDigit() on the primitive type char
 
Ah that's why, I thought the class char and character were the same thing, so when I looked at the api I couldn't understand why it didn't work.
 
Can someone also tell me why does this not work.

Code:
if (email.charAt(i) == "@")

Says incompatible types string and char, works fine in javascript but not java. I thought that "@" was a char?
 
Back
Top Bottom