Super Keyword in Java

Duration: 9 min

This video lesson is available to enrolled students.

Return to /learn/ASRB-ICAR-T3-T4-INFORMATION-TECHNOLOGY-PRELIMS-MAINS/oops-with-c-java/oops-with-java/inheritance/asset-super-keyword-in-java after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. Prelims: General Knowledge: Physics Chemistry Biology History Geography Polity Indian Economy Static General Knowledge GK- Current Affairs Environment
  2. Prelims: General English: Vocabulary Noun Pronoun Adjectives Preposition Articles Direct and Indirect Speech Tenses Conjunction Subject Verb Agreement (Verb Noun Agreement) Modals Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing) Sentence Correction (Error Correction) Sentence Completion (Fill in the blanks) Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions) Cloze Test (Cloze Passage) Verbal Analogy (Word Based Analogy) Sentence Construction Adverb Verb
  3. Prelims: Quantitative Aptitude: Percentage Ratio and Proportion (Ratios) HCF LCM Divisibility Rules Average Sequence and Series (Series) Number System Powers and Exponents (Surds and Indices) Algebra Profit and Loss Simple Interest and Compound Interest Time and Work Pipe and Cistern Speed Time and Distance Mixture and Alligation Mensuration and Geometry Age Problems Partnership Statistics Data Interpretation Arithmetic
  4. Prelims: General Agriculture: Agriculture in India and Tripura Natural Resource Management Fundamentals of Crop Production Horticulture Crop Improvement Crop Protection Social Science
  5. IT Mains: Operating System: Introduction to OS Process Management CPU Scheduling Process Synchronization Threads & Process Creation Deadlock Memory Management Virtual Memory Disc Scheduling File Management Distributed Systems
  6. IT Mains: Computer Networking: Introduction to CN DLL: Access Control DLL: Flow Control DLL: Error Control Data Link Layer - Ethernet Net Layer: IPv4 & Proto Net Layer: IP Addressing Net Layer:Routing Protocol Transport Layer Services TL: Congestion & UDP Application Layer Hardware Basics Network Security
  7. IT Mains: DBMS: Basics of DBMS ER Diagram Relational Model & Functional Dependencies Keys & Integrity Constraints Normalization (1NF - BCNF) Decomposition Properties & 4NF Relational Algebra SQL Relational Calculus Transaction Management Concurrency Control Database Recovery Big Data Systems Database Security & Authorization Enhanced Data Models NoSQL
  8. IT Mains: Software Engineering: Fundamentals of Software Engineering Software Requirements and Quality Assurance Software Design, Estimation and Metrics Software Testing Software Maintenance and Configuration Management
  9. IT Mains: Data Structures & Algorithms: Introduction to DS Array Stack Queue Linked List Tree Graphs Hashing Algorithm Analysis Time Complexity Analysis Sorting Algorithms
  10. IT Mains: OOPS with C++ & Java: C Fundamentals OOPS with C++ Java Fundamentals Array, String, IO & References OOPS with Java Generic & Collections Multithreading File Handling & I/O
  11. IT Mains: Python: Introduction to Python Tokens, Variables, Data Types, I/O Operators & Expressions Control Flow & Looping Collections & Strings Functions & Modules
  12. IT Mains: Website Development: Website, Browser & Services Internet Fundamentals Web Design & Development Protocols & Services Web Publishing & Hosting Server Side & Security Emerging Technologies HTML Basics HTML5 CSS JavaScript-Basics .Net Programming PHP
  13. IT Mains: Mobile App Development: Mobile Computing Multimedia
  14. IT Mains: Linux / Windows Server Admin: Unix OS Linux OS
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This lecture introduces the Java super keyword, defining it as a reference to the immediate parent class. The instructor presents three main uses: accessing parent class variables, calling parent class methods, and calling parent class constructors. A hand-drawn diagram shows a child class B extending parent class A, with arrows labeled this and super to distinguish the current object from the parent reference. The first code example defines Parent with int x = 10 and Child extends Parent with int x = 20. Child's show() method prints x and super.x, producing console output 20 then 10, demonstrating that x refers to the child's field while super.x accesses the parent's field. The second example demonstrates calling a parent method: Parent's show() prints Parent, while Child's show() prints Child and then calls super.show(), producing output Child then Parent. The final example covers constructor chaining: Parent's constructor prints Parent Constructor, and Child's constructor begins with super() before printing Child Constructor, producing output Parent Constructor then Child Constructor. A note emphasizes that super() must be the first statement inside a constructor.

Chapters

  1. 0:00 – 2:00 00:00-02:00

    The slide titled Super Keyword states that the super keyword refers to the immediate parent class and lists three uses: access parent class variables, call parent class methods, and call parent class constructor. The Main.java editor shows class Parent with int x = 10 and class Child extends Parent with int x = 20. Child's show() method prints x and super.x, with comments indicating 20 is the Child's x and 10 is the Parent's x. The console displays output lines 20 and 10, confirming that super.x resolves to the parent's field when both classes define the same variable name.

  2. 2:00 – 5:00 02:00-05:00

    The instructor reinforces the definition by circling the phrase immediate parent class in red and drawing a diagram with box B pointing up to box A, using arrows labeled this and super to show the relationship between the current object and its parent. The same Parent and Child code example remains visible, with red annotations pointing to the super.x line and the Parent class field. The numbered list of three uses is underlined in red, emphasizing that variable access is the first application of super before moving to method and constructor calls.

  3. 5:00 – 9:18 05:00-09:18

    The lecture transitions to the second use, calling parent methods. A screen titled Call Parent Method shows Parent's show() printing Parent and Child's show() printing Child then calling super.show(), with console output Child followed by Parent. The final screen, titled Call Parent Constructor, shows Parent's constructor printing Parent Constructor and Child's constructor beginning with super() before printing Child Constructor. The console displays Parent Constructor then Child Constructor, and a footer note states that super() must be the first statement inside a constructor, establishing the required order for constructor chaining.

The lecture progresses systematically through the three uses of the super keyword in Java inheritance. It begins with the core definition and a variable-access example where field hiding occurs because both Parent and Child declare int x. The this versus super distinction is clarified visually with a box diagram. The method example shows how super.show() invokes the parent's overridden method after the child's own code executes. The constructor example demonstrates mandatory chaining, where super() must appear first in the child constructor so the parent constructor runs before child initialization. Together, these examples establish that super provides explicit access to the immediate parent's members when they are hidden or overridden.

Loading lesson…