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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:07:55+00:00 2026-06-11T01:07:55+00:00

im cant figure out what is wrong with my code if someone can help

  • 0

im cant figure out what is wrong with my code if someone can help , why is it telling me this ? it gives me an error in toString method… why does it give me to insert enum body and identifier ? thank you

  import java.lang.String;

  public class Circle extends Shape {
  private double radius;

  public Circle( double theRadius ){
    super();
    if ( theRadius <= 0.0 )
        setRadius( Shape.DEFAULT_SIZE );
    else
        setRadius( theRadius );
}



public double getSurfaceArea(){

    return this.radius * this.radius * Math.PI;
}

public double getPeremeter(){
    ;
    return 2 * this.radius + Math.PI;
}

public double getRadius(){
    return this.radius;

}

public void setRadius( double theRadius ) {
    if( theRadius <= 0 )
        return;
    this.radius = theRadius;
}

@Override
public double getPerimeter() {
    // TODO Auto-generated method stub
    return 0;



     public String toString() {
         return "Circle Surface Area "+getSurfaceArea()+", Circle Peremeter "       +getPerimeter();
     }
}

@Override
public double getSizeAmount() {
    // TODO Auto-generated method stub
    return 0;
}
   }

main class

import javax.swing.JOptionPane;
 import java.text.DecimalFormat; 



 public class ShapeApp {


public static <RectangularPrism> void main(String[] args) {



    int x = 0;
    Triangle triangleObjects[] = new Triangle[ 3 ];

    triangleObjects[ 0 ] = new Rectangle("3.5","4.6");
    triangleObjects[ 1 ] = new Rectangle("3","2");

    triangleObjects[ 2 ] = new Circle(0);

    System.out.println( "List of all Shapes:\n" );
    do{
    try{
        for( Triangle currentTriangle : triangleObjects ) {
        String msg = currentTriangle.getSurfaceArea() +","+ currentTriangle.getPerimeter();
        JOptionPane.showMessageDialog(null, "Message", msg, JOptionPane.INFORMATION_MESSAGE);
        x=2;
    }

    }catch(Exception e) {

    }

}while(x==1);


    }


}

error

  Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
Syntax error on token "String", @ expected
Syntax error, insert "enum Identifier" to complete EnumHeaderName
Syntax error, insert "EnumBody" to complete BlockStatement

at Circle.getPerimeter(Circle.java:44)
at ShapeApp.main(ShapeApp.java:80)
  • 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-11T01:07:57+00:00Added an answer on June 11, 2026 at 1:07 am

    Look at your getPerimeter method:

    @Override
    public double getPerimeter() {
        // TODO Auto-generated method stub
        return 0;
    
    
    
         public String toString() {
             return "Circle Surface Area "+getSurfaceArea()+", Circle Peremeter "
                  +getPerimeter();
         }
    }
    

    You’re trying to declare the toString method within the getPerimeter method.

    The indentation of the code should have given you a hint about that – it’s one reason why it’s important to indent code appropriately. You should have:

    @Override
    public double getPerimeter() {
        // TODO Auto-generated method stub
        return 0;
    }    
    
    @Override
    public String toString() {
        return "Circle Surface Area " + getSurfaceArea() + ", Circle Perimeter "       
            + getPerimeter();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't figure out what's wrong with this snippet of code. I have an
Can someone please help me figure out what I'm doing wrong? I have a
I can't quite figure out what I'm doing wrong in my assembly code. I'm
I cant really figure out whats wrong with this. I used to write the
I can't figure out what I'm doing wrong in this template. Here's my data:
I can't figure out what exactly is wrong. This is what i get when
I get wrong exit code from waitpid and I can't figure out why. Could
Could someone take a look at this code and find out what's wrong with
I can't figure out where I am going wrong with this, I have tried
This should be simple - can't figure out where I'm going wrong: We have

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.