How to determine if a character may be part of a Java identifier

1 Answer

0 votes
package javaapplication1;
 
public class JavaApplication1 {
 
    public static void main(String[] args) {
 
        char ch = '7';

        boolean b;

        b = Character.isJavaIdentifierPart(ch);
        System.out.println(b);
        
        b = Character.isJavaIdentifierPart('!');
        System.out.println(b);
    }
}
 
/*
run:

true
false
 
*/

 



answered Sep 14, 2016 by avibootz
...