Day 4: Constructors After understanding classes, objects, encapsulation, and access modifiers, the next step is learning how objects get their initial values. That is where constructors come in. A constructor is used to initialize an object when it is created. In Java, it has the same name as the class, has no return type, and runs automatically when the object is created. Simple idea, but very important, because it helps us create objects in a cleaner and more intentional way. #Java #OOP #Programming #SoftwareEngineering #ComputerScience #koofkee
Understanding Java Constructors
More Relevant Posts
-
Day 5: Inheritance As programs grow, many classes start sharing similar properties or behavior. That is where inheritance becomes useful. Inheritance allows one class to take the properties and behavior of another class. In Java, we use `extends` to create that relationship. This helps reduce repetition and makes code easier to organize when classes are related. #Java #OOP #Programming #SoftwareEngineering #ComputerScience #koofkee
To view or add a comment, sign in
-
-
Day 7: Polymorphism After inheritance and method overriding, the next important idea is polymorphism. Polymorphism means one reference can take many forms. In Java, a parent type can hold a child object, and when a method is called, the behavior depends on the actual object behind it. That is what makes OOP more flexible and powerful. The same method call can behave differently in different classes. #Java #OOP #Programming #SoftwareEngineering #ComputerScience #koofkee
To view or add a comment, sign in
-
-
Day 3: Access Modifiers After learning about encapsulation, the next step is understanding access modifiers. In Java, access modifiers control visibility. They decide who can access a variable or method. For example, private keeps a variable inside the class, while public allows methods to be used from outside. This is important because good design is not only about writing code. It is also about controlling what should be visible and what should stay protected. #Java #OOP #Programming #SoftwareEngineering #ComputerScience #koofkee
To view or add a comment, sign in
-
-
Day 9: Interfaces After abstraction, the next important idea is interfaces. An interface defines a contract. It tells a class what behavior it must provide, without giving the full implementation itself. In Java, a class uses `implements` to follow that contract. This makes code more flexible, because different classes can follow the same interface in their own way. #Java #OOP #Programming #SoftwareEngineering #ComputerScience #koofkee
To view or add a comment, sign in
-
-
Today I practiced a simple yet important concept of Object-Oriented Programming — Method Overriding. 🔹 Created a parent class (Shape) with a draw() method 🔹 Overrode the same method in child classes Circle and Rectangle 🔹 Demonstrated runtime polymorphism using a parent class reference 💡 This example clearly shows how Java decides which method to call at runtime based on the object type. 📌 Output: Drawing a Circle Drawing a Rectangle ✨ Concepts Covered: ✔ Inheritance ✔ Method Overriding ✔ Runtime Polymorphism #Java #OOP #Programming #Coding #MethodOverriding #Polymorphism #LearningJourney #SoftwareDevelopment #JavaDeveloper
To view or add a comment, sign in
-
-
Today I learned about Runtime Polymorphism in Java. Runtime Polymorphism is achieved using method overriding, where a subclass provides its own implementation of a method defined in the parent class. It helps in achieving dynamic behavior, meaning the method call is resolved at runtime instead of compile time. Example: I created an Animal class with a sound() method, and then different animals override it with their own sound. Dog → Barks Cat → Meows This shows how the same method behaves differently based on the object. #Java #Programming #OOP #Learning #CodingJourney
To view or add a comment, sign in
-
-
Day 18 – Understanding List vs Set vs Map in Java After exploring different collections individually, today I learned how they compare with each other. 🔹 List (ArrayList) – Stores elements using index, allows duplicates, maintains order 🔹 Set (HashSet) – Stores only unique elements, no duplicates, unordered 🔹 Map (HashMap) – Stores data in key–value pairs, keys must be unique 💡 Key takeaway: Choosing the right data structure is important for writing efficient and clean code. This comparison helped me clearly understand when to use each collection type. #Java #Collections #ArrayList #HashSet #HashMap #Programming #LearningInPublic #Day18
To view or add a comment, sign in
-
-
***Learn Programming with Arrays, Lists, Sets and Maps with Practical Examples*** Session 2: Array Object in Java | Programming with Arrays, Lists, Sets and Maps Series Learn It Easy: https://lnkd.in/dYh-esat #arrays #lists #sets #maps #java #learntocode #seleniumwebdriver #automationtesting #computerprogramming #dezinnia #dezlearn #happylearning
Session 2: Array Object in Java | Programming with Arrays, Lists, Sets and Maps Series
https://www.youtube.com/
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
-
-
📘 Day 41 of My Learning Journey Today, I explored two important methods from the java.lang package: getClass() and toString(). 🔹 getClass() Method This method is used to get the runtime class of an object. It helps in understanding the exact class an object belongs to during execution. 🔹 toString() Method This method converts an object into a readable string format. By default, it returns the class name along with the hashcode, but it can be overridden to display meaningful information. 💡 Learning these methods helped me understand how Java represents objects internally and how we can customize their output for better readability. Step by step, improving my understanding of core Java concepts! 🚀 #Java #LearningJourney #Day41 #OOP #Programming #TechSkills
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