Posts

Showing posts from May, 2025

Inheritance and Polymorphism

Image
 Inheritance and Polymorphism Inheritance (Hierarchy): Constructor chaining: Git link for code: https://github.com/PuneetKumarSinghIT/java Super Keyword usage: If a person want to call specific constructor of his super class means parent which is inherited by that perticular class then that child class need to give super(parameter) to call the constructor of parent class. Please follow git repo for detailed code: https://github.com/PuneetKumarSinghIT/java The super keyword in Java is a powerful tool used to refer to the immediate parent class. It is especially useful in class inheritance scenarios.  Accessing Parent Class Methods ( Method Overriding Context): Why it's useful: When you override a method but still need to invoke the parent's   implementation (e.g., to extend or augment behavior), super.methodName() is essential. Accessing Parent Class Data Members(Variable Shadowing Context): Why it's useful: Avoids ambiguity and allows access to hidden fields from the p...

Java installation for VSCode

 Java in VS Code Download Java extension in VS code as package it will install all dependencies as well like Maven and Gragle for Java. You can create a Java project and can select for Maven project quickguide and then fillt he information and select the destination folder and it will make the think ready for you. Maven will work like charm and will install all dependencies as per expectation. To add any new dependencies into your java project you need to edit POM file and need to add new dependies under dependencies tag if it is not present in your POM and create one. Once dependencies tag is added to POM file VS code will ask for sync your config file press yes for it. It will help to build java project and test it by using VS code test icon. Junit will help you to write test classes and you can call your code method to test for desired result and can modify the code to check edge cases. For debugger you can work with your class code which has main function and then you can debug...