Day 52-What I Learned In a Day (JAVA) Today I learned some fundamental concepts in Java related to objects and methods. 🔹 Creating Objects (for Non-Static Methods) Understood that to access non-static methods, we must create an object of the class. 🔹 Steps to Create an Object 1️⃣ Declare reference variable 2️⃣ Create object using new keyword 3️⃣ Assign it to the reference 🔹 new Keyword Learned that it is used to allocate memory in the heap and create an object. 🔹 Non-Primitive Data Types Explored how objects, arrays, and classes store references instead of actual values. 🔹 Accessing Data from Another Class Learned how to access variables and methods from another class by creating an object of that class and using the reference. These concepts helped me understand how Java objects work, how memory is managed, and how classes interact with each other. #Java #OOP #Programming #LearningJourney #Coding #100DaysOfCode
Java Object Creation and Methods Fundamentals
More Relevant Posts
-
Day 55-What I Learned In a Day (JAVA) Today, I learned how to create and use constructors in Java. 🔹 A constructor is a special method used to initialize an object when it is created. 🔹 Constructors are non-static by default, meaning they work with objects and help assign values to instance variables. 🔹 They are automatically executed when an object is created, making object initialization simple and efficient. 🔹 This reduces the need for setting values manually after object creation. Understanding constructors helped me see how Java initializes objects in a structured and efficient way. #Java #OOP #Constructors #LearningJourney #Programming #TechSkills
To view or add a comment, sign in
-
Same data. Same values. Still stored twice? 🤯 That’s when I realized — Java doesn’t care about values… It cares about objects 🧠 Two objects may look identical, but for Java — they can be completely different ⚠️ And this is where many developers get confused. 🚨 Stop just watching tutorials… Real growth = Practice + Consistency 💯 🔥 Java Daily Practice ☕️ 👉 Join & start today 🔗 https://lnkd.in/gfhqgjGd 🚀 Here’s a quick challenge 👇 💬 What do you think the output will be? #Java #JavaDeveloper #HashSet #Collections #OOP #Programming #Debugging #BackendDeveloper #Coding #TechLearning #DeveloperTips #LinkedInIndia
To view or add a comment, sign in
-
Day 38 of Learning Java Today, I explored how a class executes inside the JVM (Java Virtual Machine). Understanding this lifecycle really helped me see what happens behind the scenes when we run a Java program. 🔹 Class Loading • The JVM loads the class into memory • It brings the ".class" file into the system 🔹 Linking Phase • Verification → Checks bytecode for errors • Preparation → Allocates memory for static variables (default values like 0) • Resolution → Replaces symbolic references with actual memory references 🔹 Initialization • Static variables get their actual assigned values • Static blocks are executed 🔹 Execution • Methods start running and the program logic is executed 🔹 Destruction • Objects are destroyed and memory is cleaned up by the Garbage Collector Static variables first get default values during preparation, and later their actual values during initialization. Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #JVM #LearningJourney #Programming #SoftwareDevelopment #BackendDevelopment #CodingLife #JavaDeveloper #TechLearning #StudentLife
To view or add a comment, sign in
-
-
Learning Encapsulation in Java Today I practiced one of the core concepts of OOPs — Encapsulation. Encapsulation means wrapping data (variables) and code (methods) together in a single unit (class), and controlling access using getters and setters. I created a simple Student class with: id name course Instead of accessing variables directly, I used: - private variables - public getter and setter method What I learned: - Data hiding improves security - Code becomes more controlled and maintainable - Direct access to variables should be avoided Small steps every day towards becoming a better developer #Java #OOP #Encapsulation #CodingJourney #BeginnerDeveloper
To view or add a comment, sign in
-
-
🚀 Day 48 of My Java Learning Journey Today, I explored one of the most important concepts in Java – Collection Framework 💡 📌 What I Learned: Collection Framework is a set of classes and interfaces used to store and manipulate data efficiently It was introduced in JDK 1.2 by Josh Bloch Acts as an alternative to Data Structures in Java 📊 Key Components: Interfaces → List, Set, Queue, Map Classes → ArrayList, LinkedList, HashSet, HashMap 🔥 Why Collections? ✔ Dynamic size (no fixed length like arrays) ✔ Inbuilt methods (add, remove, etc.) ✔ Efficient data handling ✔ Reduces coding effort 💻 Key Features: Allows heterogeneous data Maintains insertion order (List) Allows duplicates (List) Improves performance in real-world applications 📈 Takeaway: Collection Framework is a must-know concept for interviews and real-time development. Almost every Java application uses it! #Day48 #Java #CollectionsFramework #JavaDeveloper #LearningJourney #Coding #Programming
To view or add a comment, sign in
-
-
Day 49-What I Learned In a Day (JAVA) Today, I focused on understanding the execution flow of static elements in Java. 🔹 Learned about: • Static variables and how they are shared across objects • Static methods and how they can be accessed without object creation • Static initializer (single-line) • Static initializer (multi-line) This helped me clearly understand how Java handles memory and execution at the class level before objects are created. Building strong fundamentals step by step! #Java #Programming #LearningJourney #OOP #TechSkills
To view or add a comment, sign in
-
-
🚀 Day 9 – Understanding Functions and Memory in Java Today, I learned deeper concepts of functions (methods) in Java, especially how they work inside memory and how data is passed between them. First, I understood what happens in memory when a function is called. When a method runs, a new block called a stack frame is created in memory. Each function has its own space, and once the function finishes, that memory is removed. This helped me visualize how programs execute step by step. Next, I learned about Call by Value. In Java, values are always passed by value, not by reference. This means when we pass a variable to a function, a copy of that value is created. So, even if we change the value inside the function, the original value in the main method does not change. This concept was very important to understand. Then, I practiced writing a function to find the product of two numbers. I learned how to pass values as parameters, perform calculations inside the function, and return the result back to the main method. Finally, I worked on finding the factorial of a number (n = 4) using a loop. I understood the logic step by step: 1 × 2 × 3 × 4 = 24. This helped me improve my understanding of loops and function logic together. 💪 I will continue practicing daily and build strong programming fundamentals. #Java #Coding #DSA #LearningJourney #Consistency
To view or add a comment, sign in
-
-
Day 33/100 — Threads & Multithreading ⚡ Java can do multiple things at the same time using threads. Thread lifecycle: NEW → RUNNABLE → RUNNING → WAITING → TERMINATED 2 ways to create threads: // Method 1: extend Thread class MyThread extends Thread { public void run() { println("Running!"); } } new MyThread().start(); // NOT run()! // Method 2: Runnable lambda (preferred!) Thread t = new Thread(() -> println("Lambda thread!")); t.start(); Most important rule: ALWAYS call start() — NOT run()! → run() = normal method call (same thread) → start() = creates new thread and calls run() 3 things to remember: → Prefer Runnable over extending Thread → start() not run() → Multiple threads = race conditions possible! 🎯 Challenge: Create 3 threads that each print their name 5 times. Observe the interleaved output! #Java #Threads #Multithreading #CoreJava #100DaysOfJava #100DaysOfCode
To view or add a comment, sign in
-
-
Continuing my Java learning journey, I’ve recently explored concepts related to file management and data persistence, which are essential for real-world applications. Here are the topics I covered: File Handling in Java using classes like File, FileReader, FileWriter, BufferedReader, and BufferedWriter Serialization for converting objects into a byte stream for storage or transmission Deserialization for reconstructing objects from stored byte streams JAR files and how they are used to package and distribute Java applications These concepts helped me understand how Java handles data storage, object persistence, and application deployment. Gradually building the skills needed to develop complete and deployable Java applications. #Java #FileHandling #Serialization #Programming #LearningJourney #SoftwareDevelopment #CDAC
To view or add a comment, sign in
-
-
Day 89 of #100DaysOfLeetCode 💻✅ Solved #15. 3Sum problem in Java. Approach: • Sorted the array first • Fixed one element and used Two Pointers for the rest • Skipped duplicates to avoid repeated triplets • Adjusted pointers based on sum comparison Performance: ✓ Runtime: 30 ms (Beats 87.77% submissions) ✓ Memory: 59.02 MB (Beats 77.30% submissions) Key Learning: ✓ Mastered Two Pointer technique with sorting ✓ Learned handling duplicates efficiently ✓ Improved problem-solving for combination-based problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #TwoPointers #Arrays #Sorting #ProblemSolving #CodingJourney #100DaysOfCode
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