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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:19:48+00:00 2026-06-12T15:19:48+00:00

Right now I am trying to instantiate the Circle class (which is a subclass

  • 0

Right now I am trying to instantiate the Circle class (which is a subclass of Shape) in a method in my menu class. But the problem is that I keep getting a compiler error say Circle cannot be resolved to a type. In other words in does not even recognize my Circle class as an instance, it just thinks it’s another variable. I’ve tried using variables in the instantiation and I have tried using setters in the constructor.

Here is the method in the menu class where I am trying to instantiate Circle

public void select_case()
    {
        switch (menu_select)
        {
            case 1: Circle c = new Circle(1);
                    break;



        }

    } 

Just in case you need to know, menu_select is a private integer variable.

Here is the code for my Circle class. I am only going to show the constructors to make less clutter.

public class Circle extends Shape 
{
    final private pi = Java.lang.Math.PI;
    //Constructor
     Circle(double r)
     {
        super(r);
     }
}

And here is the code for the shape superclass. Like the code for the circle class only the constructors are shown.

public abstract class Shape 
{
    private static double scaleFactor;
    private double base;
    private double radius;
    private double height;
    //Constructor for circle
    public Shape(double r)
    {
        radius = r;
    }   
    //Constructor for rectangle
    public Shape(double b, double h)
    {
        base = b;
        height = h;
    }


}
  • 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-12T15:19:49+00:00Added an answer on June 12, 2026 at 3:19 pm
    final private pi = Java.lang.Math.PI;
    

    should be

    private final double pi = java.lang.Math.PI;
    

    or just

    private final double pi = Math.PI;
    

    I don’t see any errors in the code other than this.

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

Sidebar

Related Questions

I'm trying to build something (ultimately a gem but for now an application) that
I'm in a bind right now trying to find the source of a problem.
I am sooo stumped right now trying to get the layout that I want...I
I am a Student..and right now trying to develop code for android..that shows nearby
Right now I am trying to create a producer/consumer thread, the producer thread goes
Right now I am trying to solve Project Euler 71 . Consider the fraction,
Right now I'm trying to create my own tiny MVC (just for practice and
Right now I'm trying desperately to get @font-face to work in my website. This
Right now I'm trying this: int a = round(n); where n is a double
Right now I'm trying to set the default audio device on Windows 7 programmatically,

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.