About 213,000 results
Open links in new tab
  1. Java default constructor - Stack Overflow

    Dec 20, 2010 · To make it explicite: if you write your own constructor, java will not create the default constructur. So if you need a constructor with arguments and a constructor without …

  2. Can a constructor in Java be private? - Stack Overflow

    May 12, 2010 · overloaded constructors - as a result of overloading methods and constructors, some may be private and some public. Especially in case when there is a non-public class that …

  3. function - Purpose of a constructor in Java? - Stack Overflow

    Nov 13, 2013 · 51 Constructors are used to initialize the instances of your classes. You use a constructor to create new objects often with parameters specifying the initial state or other …

  4. java - How do you make a deep copy of an object? - Stack Overflow

    64 You can make a deep copy with serialization without creating files. Your object you wish to deep copy will need to implement serializable. If the class isn't final or can't be modified, …

  5. What is the use of making constructor private in a class?

    Jan 14, 2010 · It doesn't do any good to just mark the constructor private; a really determined user may always use reflection to obtain the constructor. Valid uses: One good use of a protected …

  6. java - Can a class have no constructor? - Stack Overflow

    Dec 8, 2012 · Java does not actually require an explicit constructor in the class description. If you do not include a constructor, then the Java compiler will create a default constructor with an …

  7. java - how to inherit Constructor from super class to sub class

    Oct 2, 2012 · You simply pass the arguments up the constructor chain, like method calls to super classes, but using super (...) which references the super-class constructor and passes in the …

  8. constructor of subclass in Java - Stack Overflow

    1 Java provides you with a default constructor which takes no parameters. The constructor also has no body, so it is something like so: public Person() {}. The moment you define you own …

  9. Do I really need to define default constructor in java?

    Jan 10, 2017 · A default (no-argument) constructor is automatically created only when you do not define any constructor yourself. If you need two constructors, one with arguments and one …

  10. java - Why can't constructors be final, static, or abstract? - Stack ...

    The question really is why you want constructor to be static or abstract or final. Constructors aren't inherited so can't be overridden so whats the use to have final constructor Constructor is …