1. Java Keyword 👉 Definition: Keywords are reserved words in Java that have special meaning to the compiler. They cannot be used as identifiers (like variable names). 👉 Example: class , public , static , void , int , if , else public class Example { public static void main(String[] args) { int number = 10; // 'int' is a keyword if(number > 5) { // 'if' is a keyword System.out.println("Number is greater than 5"); } } } 2. Java Token 👉 Definition: A token is the smallest unit in a Java program. 👉 Types of Tokens: Keywords Identifiers Literals (numbers, characters, strings) Operators ( + , - , * , / ) Separators ( ; , {} , () ) 👉 Example: int a = 10; // Tokens: int, a, =, 10, ; 3. Java Data Types 👉 Definition: Data types define the type of data a variable can store. Two categories: Primitive Data Types (8 types) byte → 1 byte (e.g. byte b = 100; ) short → 2 bytes (e.g...
Comments
Post a Comment