Java interview classic: static vs non-static Key idea: - Static methods can access only static members directly - Instance members need an object Rule to remember: - Static = class level - Non-static = object level #Java #Interview #Static #Compiler #Software
Eid Badr’s Post
More Relevant Posts
-
🔥 Day 2 of Java Exception Handling — Things got real today Moved beyond basics into edge cases that actually get asked in interviews. Here’s what I tackled: ⚡ Exception Propagation → How exceptions move up the call stack → What happens if no one handles it ⚡ final vs finally vs finalize → 3 similar names, completely different behavior ⚡ Try-with-resources → Why it’s better than finally → AutoCloseable & preventing resource leaks ⚡ Exceptions inside finally → The dangerous part: it can override other exceptions ⚡ printStackTrace vs getMessage vs toString → Different levels of debugging info 💥 Biggest takeaway: Some exceptions don’t just fail… They hide other exceptions 😳 🎯 Next: → Day 3: Output-based questions (Time to stop knowing and start thinking) #Java #SoftwareEngineering #InterviewPrep #Developers #LearningJourney
To view or add a comment, sign in
-
-
Most developers use Strings every day… but very few actually understand what’s happening behind the scenes. Java doesn’t just store strings normally — it uses something called the String Constant Pool, which helps save memory. Sounds good, right? But here’s the catch: every time you modify a string, Java quietly creates a new object instead of changing the old one. That’s why heavy string operations (especially in loops) can slow things down without you even realizing it. A simple switch to StringBuilder in such cases can make your code much more efficient. Small change, big impact. These are the kind of concepts that don’t show up in tutorials but matter a lot in real projects and interviews.
To view or add a comment, sign in
-
-
🔥 Day 11: Comparable vs Comparator (Java) One of the most important concepts for sorting in Java — especially for interviews 👇 🔹 1. Comparable 👉 Definition: Defines the natural (default) sorting of objects inside the class itself. ✔ Found in java.lang ✔ Uses compareTo() method ✔ Only one sorting logic per class 🔹 2. Comparator 👉 Definition: Defines custom sorting logic outside the class. ✔ Found in java.util ✔ Uses compare() method ✔ Supports multiple sorting logics 🔹 When to Use? ✔ Comparable → when class has natural/default order ✔ Comparator → when you need multiple or dynamic sorting 💡 Real-Life Analogy: Comparable = Default rule 📏 Comparator = Custom rule 🎯 📌 Final Thought: "Comparable gives you one way to sort, Comparator gives you many." #Java #Comparable #Comparator #Programming #JavaDeveloper #Coding #InterviewPrep #Day11
To view or add a comment, sign in
-
-
Most Java beginners make this mistake with Lists... They use ArrayList everywhere without thinking twice. But here's what you should know: Use ArrayList → when you need fast random access Use LinkedList → when you do frequent insertions/deletions Use Vector → when you need thread-safe operations Choosing the right Collection = cleaner, faster code. Save this. You'll need it in your next interview. #Java #JavaDeve er #Collections #CodingTips #StuuentDeveloper
To view or add a comment, sign in
-
𝗤𝗔 𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗼𝗻 𝗶𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀 - 𝗠𝗮𝘃𝗲𝗿𝗶𝗰 𝗦𝘆𝘀𝘁𝗲𝗺𝘀 1. How is HashMap used in Java projects? 2. How are Collections in Java used within a project? 3. How will you ensure all test cases for the Login page have passed? 4. Write a Java program to find the number of occurrences of a specific character in your name. 5. Write XPath expressions to capture all the language occurrences in a Wikipedia page. 6. Explain the role of Constructors in Java and their purpose. 7. How would you swap two values without using a third variable? 8. What are the different data types in Java? 9. How do you utilize an Object Repository in your automation framework? 10. What essential Git commands do you use, and how do you merge code using Git? 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦-𝐉𝐚𝐯𝐚 & 𝐏𝐥𝐚𝐲𝐰𝐫𝐢𝐠𝐡𝐭-𝐓𝐲𝐩𝐞𝐒𝐜𝐫𝐢𝐩𝐭 𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐒𝐭𝐚𝐫𝐭𝐬 𝐨𝐧 𝟐𝟎𝐭𝐡 𝐀𝐩𝐫𝐢𝐥 𝟐𝟎𝟐𝟔! 𝐑𝐞𝐠𝐢𝐬𝐭𝐞𝐫 𝐧𝐨𝐰 𝐟𝐨𝐫 𝐟𝐫𝐞𝐞 𝐝𝐞𝐦𝐨 𝐜𝐥𝐚𝐬𝐬𝐞𝐬: https://lnkd.in/gWW-pJxC #Java #SeleniumWebdriver #TestAutomation #QualityAssurance #SoftwareTesting #ManualTesting
To view or add a comment, sign in
-
🚀 Day 4 of Java Exception Handling — Filling the gaps Today wasn’t about learning new flashy concepts… It was about fixing the small things that actually decide interviews. 💡 What I covered: 🔹 Error vs Exception → Errors = serious, unrecoverable → Exceptions = can be handled 🔹 try without catch → Valid if followed by finally → Small syntax rule, easy to miss 🔹 Method overriding & exceptions → Checked exceptions are restricted → Unchecked exceptions are flexible 🔹 Rethrowing exceptions → throw e; vs throw new Exception(e); → Same exception vs wrapped exception 🔹 Exception hierarchy → Throwable → Error → Exception → RuntimeException ⚡ Biggest realization: It’s not the big concepts that trip you… It’s the small rules you think you know but can’t explain clearly. 🎯 What changed today: I focused less on: “learning more” And more on: “explaining what I already know correctly” 🔥 Next step: → Mock interview + speaking practice → No hesitation, no guessing, clean answers If you’re preparing for Java interviews: 👉 Don’t ignore these “small” topics. They’re asked more than you think. #Java #InterviewPreparation #CodingJourney #Developers #LearnInPublic #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Java Concept Series JDK vs JRE vs JVM 🔥 Understanding the core of Java: JDK = Develop JRE = Run JVM = Execute Simple concepts, but very important for interviews. 👉 Next: Data Types in Java #Java #Programming #CodingJourney #PlacementPreparation #LearnInPublic
To view or add a comment, sign in
-
-
🚀 Technical Round 2 – Java Interview Questions (Real Experience) Cleared Round 1… and then came the real test 💥 Technical Round 2 is where depth matters, not just syntax. Here are some of the most asked Java questions I encountered 👇 ⸻ 🔹 Core Java Deep Dive * Difference between Heap vs Stack Memory * How does Garbage Collection work internally? * What is Immutable class & how to design one? * Explain equals() vs hashCode() with real use case * What happens when you use final, finally, finalize? ⸻ 🔹 OOP & Design * SOLID principles (with practical examples) * Design a Parking Lot / URL Shortener * What is Abstraction vs Encapsulation in real projects? ⸻ 🔹 Collections & Performance * Internal working of HashMap * Difference between ArrayList vs LinkedList * How ConcurrentHashMap works? ⸻ 🔹 Java 8+ (Must Ask 🔥) * What happens behind Lambda Expressions? * Explain Stream API pipeline * Difference between map() vs flatMap() * Use of Optional in production code ⸻ 🔹 Multithreading (Game Changer Round) * Difference between Thread vs Runnable * What is Deadlock & how to avoid it? * Explain synchronized vs Lock * Thread Pool & Executor Framework ⸻ 🔹 Spring Boot (Very Important ⚡) * How does Spring Boot Auto Configuration work? * Difference between @Component, @Service, @Repository * What happens internally when you hit a REST API? * How to handle Exception globally? * Basics of Spring Security (JWT flow) ⸻ 💡 Reality Check: Round 2 is not about remembering answers… It’s about explaining your thinking + real project usage. ⸻ 🔥 Pro Tip: If you can explain “why this is used in real projects”, you are already ahead of 80% candidates. ⸻ 📌 Follow Narendra Sahoo and subscribe to my channel — I’ll guide you step by step through Java, Spring Boot, and interview preparation. ⸻ #Java #SpringBoot #InterviewPreparation #SoftwareEngineer #TechCareers #Developers #CodingInterview
To view or add a comment, sign in
-
-
Top 5 Java 8 features every developer should know 1. Lambda Expressions 2. Streams API 3. Functional Interfaces 4. Optional Class 5. Method References If you’re preparing for interviews, you will definitely be asked these. Don’t just learn syntax— understand where to use them. #Java #Java8 #Coding #BackendDeveloper #InterviewPrep
To view or add a comment, sign in
-
🚀 Why Map is NOT Part of Collection Interface in Java? This is one of the most common interview questions — and the answer is simpler than you think 👇 🔹 The Core Difference ✔ Collection → Stores a group of individual elements ✔ Map → Stores key-value pairs (Entry = Key + Value) 👉 Because of this structural difference, Map doesn’t fit into the Collection hierarchy. 🔹 Why Map is Separate? ✔ Collection deals with single objects ✔ Map deals with pairs (key + value) ✔ Map has different operations (put, get, keySet, entrySet) ✔ No direct concept of “element” like in List or Set 🔹 Simple Understanding 📌 Collection = List of items 📌 Map = Dictionary (Key → Value) 💡 Key Insight: «Map follows a different data model, so it is designed as a separate interface in Java.» 🔥 Understanding fundamentals like this makes you stronger in interviews and real-world coding #Java #CoreJava #Collections #Map #DataStructures #Programming #CodingInterview #Developers #SoftwareDevelopment #LearnJava 🚀
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development