In future, it helps us if you post any compiler or runtime errors you get.
You need to "escape" the sybol by preceding it with a back slash:
Code:
public class Test {
public static void main(String[] args) {
char c1 = 'a';
if (c1 != '\'') {
System.out.println("Not '!");
}
}
}
11-06-2003, 06:57 PM
star2000
you can not write
if (c1 != ''')
if i write c1 = '''; it gives an error that says "empty character literal" so i want to use the unicode for ' to avoid the problem. what is the unicode for '
thanks
11-06-2003, 07:06 PM
ArchAngel
The forum keeps getting rid of my extra backslash. I've worked out how to keep it now:
Code:
public class Test {
public static void main(String[] args) {
char c1 = 'a';
if (c1 != '\\'') {
System.out.println("Not '!");
}
}
}
11-06-2003, 07:15 PM
star2000
Now it works nicely ...............many thanks for your efforts.