About 94,100 results
Open links in new tab
  1. Java Constructors - W3Schools

    A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes:

  2. Java Constructors - GeeksforGeeks

    Jan 20, 2026 · A constructor in Java is a special member that is called when an object is created. It initializes the new object’s state. It is used to set default or user-defined values for the object's …

  3. Java Constructors (With Examples) - Programiz

    Constructors in Java are similar to methods that are invoked when an object of the class is created. In this tutorial, we will learn about Java constructors and their types with the help of examples.

  4. How to Use Constructors in Java: A Beginner's Guide

    Jul 8, 2025 · Constructors are special types of methods with no return type. They are basically used to initialise the object, to set up its internal state, or to assign default values to its attributes. In this …

  5. Providing Constructors for Your Classes (The Java™ Tutorials - Oracle

    As with methods, the Java platform differentiates constructors on the basis of the number of arguments in the list and their types. You cannot write two constructors that have the same number and type of …

  6. Java - Constructors - Online Tutorials Library

    To create a constructor in Java, simply write the constructor's name (that is the same as the class name) followed by the brackets and then write the constructor's body inside the curly braces ({}).

  7. A Guide to Constructors in Java - Baeldung

    Jan 8, 2024 · Constructors are the gatekeepers of object-oriented design. In this tutorial, we’ll see how they act as a single location from which to initialize the internal state of the object being created.

  8. All You Need to Know About Java Constructor - Hackr

    Jan 30, 2025 · There are two types of constructors in Java: Default Constructor or no-arg constructor. The Java Default Constructor has no parameters. This is why it is also known as a no-arg …

  9. Constructors in Java - DEV Community

    2 days ago · Constructors cannot be inherited Can be overloaded If no constructor is defined, Java provides a default constructor 🔹 this Keyword in Java The this keyword in Java is used to refer to the …

  10. Java Constructors - Sanfoundry

    Learn about Java constructors, their types, and how they work. Understand default, parameterized, and copy constructors, along with overloading, rules, and real-world applications.