No, true and false are not keywords in java. They are literals in java. As literals are reserved words in java so we cannot use them as identifiers in our program.
Example
public class Main { public static void main(String args[]){ int true = 10; String false = "jai"; } } |
Output
Main.java:3: error: not a statement int true = 10; ^ Main.java:3: error: ';' expected int true = 10; ^ Main.java:4: error: not a statement String false = "jai"; ^ Main.java:4: error: ';' expected String false = "jai"; ^ 4 errors |