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 7866625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:27:22+00:00 2026-06-03T00:27:22+00:00

i was developing the below code…. class P { //public P(){} public P(int i)

  • 0

i was developing the below code….

class P {
    //public P(){}
    public P(int i) {

    }
}

class D extends P {
    public D(){ // default constructor must be defined in super class

    }
}

public class agf {      
    public static void main(String[] args) {

    }
}

Now in class p explicit parametrized constructor is defined and in class D default constructor is defined but it is still showing the compile time error ,please explain

  • 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-06-03T00:27:23+00:00Added an answer on June 3, 2026 at 12:27 am

    In the subclass, if you don’t invoke a superclass constructor explicitly, there must be a default superclass constructor that the VM can invoke for you.

    In the superclass, if you explicitly define a constructor, the default no-argument constructor is NOT generated by the compiler.

    Therefore, in the situation you show, you defined a non-default constructor in the superclass, which prevented the compiler from generating the default no-arg constructor. Then in the subclass, you didn’t explicitly invoke a constructor in the superclass. The compiler tried to generate a no-arg superclass constructor call and didn’t find a suitable constructor to call.

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

Sidebar

Related Questions

i was developing the below code static String m(float i) { return float; }
i'm developing test for REST using shoulda and factory_girl. Code below context on :delete
I am developing a website in linux in codeigniter I have the below url
I've been evaluating technology stack for developing a social network based application. Below are
I´m developing a software in C# that uses static functions from a C++ .dll
I've been developing with JS for a while, and while I know that code
I'm developing an application with the help of sample code from the WWDC 2010
Developing a project of mine I realize I have a need for some level
Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart
Developing a project in Django with my IDE setup as Eclipse with PyDev. The

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.