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

  • Home
  • SEARCH
  • 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 8991437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:43:35+00:00 2026-06-15T22:43:35+00:00

My code – public abstract class Level1Class { protected double num = 0.0D; protected

  • 0

My code –

public abstract class Level1Class
{
  protected double num = 0.0D;  
  protected Level1Class(){}
  protected Level1Class(double num){this.num = num;}
  protected abstract methods A, B, C...etc //pseudocode !

}

public class Level2Class extends Level1Class
{
  //NO CONSTRUCTORS HERE
  //BUT, only implementation of methods A,B, C
} 

public class Tester
{
  Level2Class l2c = new Level2Class(10.0D); //This causes the compiler error ! 
}

Can someone tell me why I get this error. I know it will go if I create the necessary constructor in Level2Class. But, I want to know the reason.

  • 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-15T22:43:36+00:00Added an answer on June 15, 2026 at 10:43 pm

    Level2Class have a only default constructor which would be implemented by compiler. Level2Class does not have constructor which takes double as parameter.

    Level2Class l2c = new Level2Class(10.0D);
    

    This will try to figure out double constructor in Level2Class class which is not available because constructor are not inherited.

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

Sidebar

Related Questions

Code: public class SMH extends Activity { public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main);
Code class cat{ public: void walk(){ printf(cat is walking \n); } void myAbc(){ void
Code #include <OOLua/oolua.h> class foo { public: int bar(); }; OOLUA_CLASS_NO_BASES(foo)//class has no bases
CODE:1 class Ajay { private void display() { System.out.println(Ajay); } public static void main(String
Code for button: Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Code sample for my question: IList<TestDataAnimal> testDataFromDb = this.db.TestDataAnimals.Include(t => t.TestType).Include(t => t.Visit).Include(t =>
code: class Node: def __init__(self, key, children=[]): self.key = key self.children = children def
Code goes first: void foo(int x) { void bar(int); //is this forward-decl legal? bar(x);
Code: $(#telecomGrayscale, this).stop().animate({ top: '467px' }, { duration: 400 }).delay(800).queue(function() { $(#boxcaptionTelecom, this).stop().animate({ top:
Code sample should explain things: class A { B* pB; C* pC; D d;

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.