Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 548773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:06:54+00:00 2026-05-13T11:06:54+00:00

Isn’t this one automatically put by the compiler if I don’t put it in

  • 0

Isn’t this one automatically put by the compiler if I don’t put it in a subclass’s constructor?

That means I don’t even need to care about it? In some articles they put it out.

And if I’ve got one constructor with arguments, will this be the constructor, or does it take a constructor without argument list?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:06:54+00:00Added an answer on May 13, 2026 at 11:06 am

    Firstly some terminology:

    • No-args constructor: a constructor with no parameters;
    • Accessible no-args constructor: a no-args constructor in the superclass visible to the subclass. That means it is either public or protected or, if both classes are in the same package, package access; and
    • Default constructor: the public no-args constructor added by the compiler when there is no explicit constructor in the class.

    So all classes have at least one constructor.

    Subclasses constructors may specify as the first thing they do which constructor in the superclass to invoke before executing the code in the subclass’s constructor.

    If the subclass constructor does not specify which superclass constructor to invoke then the compiler will automatically call the accessible no-args constructor in the superclass.

    If the superclass has no no-arg constructor or it isn’t accessible then not specifying the superclass constructor to be called (in the subclass constructor) is a compiler error so it must be specified.

    For example:

    public class Base { }
    public class Derived extends Base { }
    

    This is fine because if you add no constructor explicitly Java puts in a public default constructor for you.

    public class Base { }
    public class Derived extends Base { public Derived(int i) { } }
    

    Also fine.

    public class Base { public Base(String s) { } }
    public class Derived extends Base { }
    

    The above is a compilation error as Base has no default constructor.

    public class Base { private Base() { } }
    public class Derived extends Base { }
    

    This is also an error because Base’s no-args constructor is private.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This isn't working in ruby and I don't understand why? #!/usr/bin/env ruby exec sort
This isn't legal: public class MyBaseClass { public MyBaseClass() {} public MyBaseClass(object arg) {}
This isn't a holy war, this isn't a question of which is better. What
Why isn't this project maintained anymore? I love this app, however not updating it
This isn't as malicious as it sounds, I want to get the current size
This isn't a question but I thought I'd start a thread where links to
Isn't there a trick that may help me show a component inside a grid
This isn't a real fluent interface. I have an object which builds up a
This isn't a homework question, by the way. It got brought up in class
Why isn't Manipulate[] working with large numbers? For instance this works Manipulate[k, {k, 0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.