Basics of Java Programming: Keywords, Literals, and Identifiers
Basics of Java Program The basics of a Java program include keywords, literals, and identifiers. These are the fundamental building blocks used while writing Java code. 1. Keywords Keywords are reserved words in Java that have predefined meanings and functionality for the Java compiler. Key points: Keywords must be written in lowercase. Java has 50 reserved keywords. Out of these, 48 keywords have predefined meaning and functionality. The remaining 2 reserved words (goto and const) are not used and have no functionality. Examples of Java keywords: class static final public void Keywords cannot be used as variable names, method names, or identifiers. 2. Literals Literals are fixed values that are directly stored in a Java program. Java supports five types of literals: Integer Literals: Eg:- 1, 25, 100 Floating-Point Literals: Eg:- 1.5, 2.75 Character Literals: Eg:- 'a', 'Z' String Literals: Eg:- "Java", "Programming" Boolean Literals: Eg:- true, false...