Java Non-Access Modifiers Explained: static, final, abstract, synchronized, transient, volatile, native

🔥 Java Deep Dive – Understanding How Java Really Works (Post #2) In my previous post, I explored Java Access Modifiers (public, private, protected, default) — how we control visibility 🔐 Today, I took the next step… 👉 Non-Access Modifiers in Java — controlling behavior ⚙️ I’m still learning and exploring, and sharing my understanding along the way to grow with the community 🙌 💡 My Understanding (with real-world + code) 🔹 static – Shared Across All Objects 🏢 ➡️ Like a company name — same for every employee class Company {    static String companyName = "ABC Pvt Ltd"; } 👉 No need to create objects — shared everywhere 🔹 final – Cannot Be Changed 🔒 ➡️ Like your NIC / Date of Birth class Person {    final String nic = "200012345678"; } 👉 Once assigned → ❌ cannot modify 🔹 abstract – Blueprint 🧩 ➡️ Like a Vehicle concept (rules, not implementation) abstract class Vehicle {    abstract void start(); } class Car extends Vehicle {    void start() {        System.out.println("Start with key");    } } 👉 Defines what to do, not how 🔹 synchronized – One at a Time 🏧 ➡️ Like an ATM machine synchronized void withdraw() {    // only one thread at a time } 🔹 transient – Do Not Store 🚫💾 ➡️ Like passwords / PINs transient String password; 🔹 volatile – Always Latest Value 📡 ➡️ Like a live cricket score volatile int score; 🔹 native – External Power ⚡ ➡️ Calls C/C++ code for system-level operations native void print(); 🧠 Big Picture ✔️ Access Modifiers → Who can access 🔐 ✔️ Non-Access Modifiers → How things behave ⚙️ 🚀 My Learning Approach I’m currently focusing on: ✔️ Understanding concepts with real-world thinking ✔️ Writing simple code examples ✔️ Building a strong Core Java foundation 📌 I’m still learning, and I know there’s a lot more to improve — So I’m sharing my journey to learn better and connect with others in the same path 🤝 🔜 What’s Next? 👉 Understanding how Access Modifiers and Non-Access Modifiers are stored in memory (Stack vs Heap) 💬 If you have suggestions, corrections, or tips — I’d truly appreciate it! #Java #SoftwareEngineering #BackendDevelopment #LearningJourney #100DaysOfCode

  • graphical user interface, application

To view or add a comment, sign in

Explore content categories