Posts

Showing posts from June, 2026

Identifiers

Java Identifiers Java Identifiers An Identifier is a name given to different elements in a Java program so that they can be identified uniquely. In simple words, an identifier is the name you give to things like: Class Method Variable Interface Package Label These names help Java identify and differentiate one element from another. 🧠 Let's Test Your Understanding! How many identifiers are there in the following Java program? public class Test { public static void main(String[] args) { int x = 10; } } Answer: 5 Identifiers Test → Class name main → Method name String → Predefined class name args → Parameter (variable) x → Local variable Rules for Java Identifiers Before giving a name to a class, method, or variable, you should know these rules. 1. Allowed Characters A Java identifier can contain only: Letters (A-Z, a-z) Digits (0-9) Dollar Sign ($) Underscore (_) Using any other sp...

Java Reserved Words (Keywords & Literals)

Image
Imagine you're talking to Java. Just like we use words such as "if" , "while" , or "return" in English to express a meaning, Java also has its own special words. These words already have a predefined meaning, so we cannot use them as variable names, class names, or method names. These special words are called Reserved Words . What are Reserved Words? Reserved Words are words that are already reserved by Java to perform a specific task or represent a specific value. For example, int age = 20; Here, int is a reserved word that tells Java the variable will store an integer value. If you try to use a reserved word as a variable name, int class = 10; ❌  Compile Time Error Because class is already reserved by Java. 1. Keywords (50) Keywords are reserved words that tell Java what action to perform . Instead of memorizing all 50 keywords randomly, it's much easier to learn them category by category. Used Keywords (48) For Datatypes: (8)       byte, s...

Java Roadmap

Image
Introduction Whenever someone starts learning programming, one question always comes up: "Where should I start Java?" There are hundreds of tutorials, courses, and videos available online, which often makes beginners confused. This blog is not about learning Java in one day. It's about understanding what Java is and the roadmap you should follow to learn it step by step without feeling overwhelmed. What is Java? Why is it Called Java?  Interestingly, Java wasn't always called Java. When it was first created by James Gosling and his team, its name was Oak , inspired by an oak tree outside his office. Later, they found that "Oak" was already trademarked, so they needed a new name. Since the team loved drinking coffee while working, they chose the name Java , which is also a famous type of coffee. And that's how Java got its name! ☕ My Java Learning Roadmap? Conclusion Learning Java is not about completing topics quickly. It's about building concepts on...