Java Fundamentals: Tokens, Name Casing, Data Types & Variables

🚀 Day 2,3 of My Java Learning Journey These days I have explored the core fundamentals of Java and summarized them in simple, clear points. 🔹 Tokens in Java ⚡Identifiers: Names given to variables, classes, methods, and objects. They uniquely identify elements in the program.Examples: age, Student, calculateTotal(). ⚡Literals: Fixed values that never change during execution. Examples: 10, 3.14, 'A', "Java", true. ⚡Operators: Symbols used to perform actions like arithmetic, comparison, logical checks, or assigning values.Examples: +, -, >, <, &&, =. ⚡Separators: Symbols that structure Java code such as (), {}, [], ;, ,. They help define blocks, statements, parameters, and arrays. ⚡Comments: Non-executable notes that improve code readability. Types: // (single-line), /*…*/ (multi-line), /**…*/ (documentation). 🔹 Name Casing 🧩 PascalCase: Every word starts with a capital letter. Used for classes and interfaces.Example: StudentDetails. 🧩 camelCase: First word lowercase, next words start with uppercase. Used for variables and methods.Example: studentName, calculateTotal(). 🧩 snake_case: All lowercase with underscores. Rare in Java but common in databases.Example: employee_id. 🔹 Data Types in Java A data type defines what kind of data a variable can store and how much memory it uses. • Primitive Data Types (8 types) Store single values; fast and memory-efficient. Types: byte,short,int,long,float,double,char,boolean • Non-Primitive Data Types Reference types that store memory addresses and can grow in size. Examples: String, Arrays, Classes, Interfaces, Objects. 🔹 Variables in Java A variable is a memory location used to store values while the program runs. 🔸Local Variables: Declared inside methods or blocks.Exist only within that scope and have no default value. 🔸Instance Variables: Declared inside a class but outside methods.Each object gets its own copy, with default values based on the data type. Can be accessed with object reference. 🔸Static Variables: Declared inside the class and outside the method using static keyword. Shared by all objects of the class and initialized once in memory. Can be accessed by using class name. 🌱 These fundamentals explain Java's base and help in the creation of structured, readable, and effective programs. I'm eager to learn more! hashtag #Java hashtag #LearningJourney hashtag #ProgrammingBasics hashtag #TechSkills hashtag #CodeNewbie hashtag #SoftwareDevelopment Guided by: Levaku Lavanya mam, Saketh Kallepu sir, Uppugundla Sairam sir.

To view or add a comment, sign in

Explore content categories