Constructors in Java

Duration: 13 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/constructors-in-java/asset-constructors-in-java-25120 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 constructors in Java within an OOPS course. It defines a constructor as a special block of code that runs automatically when an object is created using the new keyword, primarily to initialize object variables. A simple Student class example is used throughout, where the constructor prints "Object created" to the console when instantiated in the Main class. The instructor annotates the code to highlight the constructor definition and the new Student() call. The lesson then presents seven rules for constructors, emphasizing that the constructor name must match the class name and that it has no return type, not even void. A comparison table contrasts constructors with methods across purpose, name, return type, calling, and inheritance.

Chapters

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

    The video opens with a title slide reading "OOPS with Java" and "Constructors in Java." It then switches to a "Constructor" slide defining a constructor as a special block of code that runs automatically when an object is created using new. A Student class example is shown with a constructor printing "Object created," and the console output confirms execution. The instructor highlights the new Student() line in Main.java where the constructor is called.

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

    The instructor continues explaining the constructor concept using the same Student class example. Red annotations are added to highlight the constructor definition Student() and the object creation line Student s = new Student(). Arrows connect the constructor definition to its invocation, and the console output "Object created" is shown to demonstrate automatic execution. The instructor also adds a line int no; to the class, suggesting initialization of variables.

  3. 5:00 – 10:00 05:00-10:00

    The lesson transitions to a slide titled "Rules of a Constructor" listing seven numbered points. Key phrases such as "same as the class name" and "no return type" are underlined in red. A table headed "Difference between Constructor and Method" compares rows for Purpose, Name, Return Type, Calling, and Inheritance. The screen then returns to the IDE showing Student.java and Main.java with red marks around new Student() and the comment "// constructor is called here."

  4. 10:00 – 13:02 10:00-13:02

    The video revisits the constructor definition and the Student class example, with handwritten annotations highlighting the new keyword and constructor call. The "Rules of a Constructor" list is shown again, covering naming and return types. The comparison table between constructors and methods is displayed with checkmarks emphasizing key differences. The final frames show a static slide with the definition, code example, and console output "Object created."

The lecture builds from a basic definition of constructors to practical rules and comparisons. The central idea is that constructors are automatically invoked during object creation via new, serving to initialize objects. The Student class example provides a consistent, simple demonstration throughout. The rules section formalizes the syntax: constructor name equals class name, no return type. The comparison table distinguishes constructors from methods, reinforcing that constructors are not inherited and are called implicitly. The teaching flow moves from concept to example to rules to differentiation, suitable for introductory OOPS revision.

Loading lesson…