Constructors in Java

Bharath Thippireddy
A free video tutorial from Bharath Thippireddy
IT Architect and Best Selling Instructor- 450000+ students
4.5 instructor rating • 35 courses • 464,358 students

Learn more from the full course

Core Java Made Easy (Covers the latest Java 15)

Master java in quick and simple steps

24:49:17 of on-demand video • Updated October 2021

  • Learn the fundamentals of java and oops
  • Learn the building blocks of a java program
  • Handle Exceptions
  • Use flow control and looping statements
  • Implement encapsulation polymorphism inheritance and abstraction
  • Read and Write files
  • Write multi threaded programs
  • Understand and use Garbage Collection
  • Learn and create the different types of inner classes
  • Understand and master Strings
  • Learn collections in depth
  • Use functional interfaces and lambda expressions
  • Understand the internal of JVM
  • Interview Questions updated regularly
  • Use Concurrent Collections and Enums
  • Implement Internationalization and also use annotations
  • See how reflection API can be used to dynamically load classes ,create objects and invoke methods
  • Gain debugging skills
  • Work on various usecases and coding problems
  • Understand and use Wrapper Classes and Autoboxing
  • Use Datatypes, Literals, Variables and Typecasting
  • Implement Inter Thread Communication
  • Specify different access modifiers
  • Use Datatypes, Literals, Variables and Typecasting
  • All in quick and easy steps
English What are constructors? How do they differ from other methods of the class? Can we invoke one constructor from another constructor? And can we invoke the superclass constructor from the child class constructor? Let's take a look. A constructor is a method that is used to initialize the properties of an object when it is created. It has the same name as the class name. Unlike the other methods, in this case, class Accord, the constructor is also Accord. But the other methods start and stop have different names of their own. But the constructor name is the same name as the class name. The constructor is only invoked when the instance or the object of that class is created. Whereas the other methods can be invoked as many number of times as we want. To invoke other constructors in the same class, we use the this method. And we can pass in the parameters just like any other method. And if the class Accord extends class Honda, to invoke the superclass' constructor, the Honda's constructor from within the child class constructor, we use the super method and pass in any parameters.