+ 1
How to check the given string keyword or not in java
Please any one tell me this is my work
4 ответов
+ 2
You can use this:
import javax.lang.model.SourceVersion;
SourceVersion has a isKeyword() method.
read a string, than:
System.out.println(Sourceversion.isKeyword(YourString);
If the String contains a keyword: true else false
+ 1
You probably need to create an array of java keywords to achieve your result.
https://softwareengineering.stackexchange.com/questions/210806/does-java-have-a-built-in-method-to-determine-if-an-identifier-is-legal
0
Is this code will used to print the given string is key word or not