Imp Doc Java
Imp Doc Java
📌 Concept:
⚡ Important Points:
Used to structure code logic, like declaring data types (int), control
flow (if), class structure (class, public, static).
✅ Examples:
if – conditional branching
📌 Concept:
⚡ Important Points:
The value in a variable can be updated at any time — hence the name
variable.
🧠 Assignment:
Example:
int age = 42; // ✅ Correct way to declare and assign an integer variable
in Java
Once declared, you can reassign the variable without re-declaring its
type.
📌 Concept:
Java uses static typing, which means the data type is bound to the
variable when it's defined.
⚡ Important Points:
🧠 Key Takeaway:
Static typing in Java improves reliability and helps catch errors early.
📌 Concept:
⚡ Important Points:
🧠 Example:
📌 Concept:
⚡ Primitive Values:
Java has 8 primitive types: int, long, short, byte, float, double, char,
boolean.
⚡ Reference Values:
Used with object types like String, Integer, arrays, and custom
classes.
🧠 Syntax Comparison:
// Primitive type
// Object type
🧠 Key Differences:
Primitive types: Start with lowercase letters and store raw values.
📌 Concept:
o Automatic (Widening)
o Manual (Narrowing)
Example:
int num = 3;
No precision is lost.
Example: