Java code help?

I'm currently learning Java programming at school. But our teacher didn't explain to us properly how to do our assignment. Now I need help. We're programming in BlueJ and are supposed to create a double method in our CIRCLE class script that calculates the circumference. But BlueJ is displaying an error at the end of the method's parentheses. Please help me! Here's the code:

 public class KREIS {   //Attribute   private int mittelpunktX;   private int mittelpunktY;   private int radius;   private String fuellfarbe;   //Konstruktor   public KREIS(int mittelpunktXneu, int mittelpunktYneu, int radiusneu, String fuellfarbeneu)   {       mittelpunktX=mittelpunktXneu;       mittelpunktY=mittelpunktYneu;       radius=radiusneu;       fuellfarbe=fuellfarbeneu;   }   //Methode   public void setzeMittelpunkt(int mittelpunktXNew, int mittelpunktYNew)   {       mittelpunktX=mittelpunktXNew;       mittelpunktY=mittelpunktYNew;   }   public void zeichne()   {       ZEICHENFENSTER.gibFenster().fuelleKreis(mittelpunktX,mittelpunktY,radius,fuellfarbe);   }   public void setzeFarbe(String fuellfarbeNeu)   {       fuellfarbe=fuellfarbeNeu;   }   public double UmfangBerechnen(radiusNeu);   {      return radiusNeu*2*3.14;   } }
(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
9 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Suiram1
11 months ago

You have a semicolon there that doesn’t belong there. Semi-colons come only at the end of a ‘command’ and not after a declaration.

Suiram1
11 months ago
Reply to  Leonhxrd

Is it another mistake or the same?

Suiram1
11 months ago

Did you remove the semicolon there? With the semicolon that too much, I mean that after the clamp.

UmfangBerechnen(radiusNeu|); <------------ Das hier meine ich

The method would be right to make sure that:

public double UmfangBerechnen(radiusNeu)
{
    return radiusNeu * 2 * 3.14;
}
crimsonfire
11 months ago

it is completely irrelevant which program you use (BlueJ), more important would be the Java version.
Your error: radiusNew to ComprehensiveCalculation has no type. In addition, you should write the NamingConvention after the u at the beginning small because it is a method name

TechnikSpezi
11 months ago

You have two mistakes:

  1. The semicolon behind the method declaration (the method head) by the method Calculate volume. By the way: You use PascalCase here (Umfang calculation) instead of camelCase (umfang calculation). The “U” should therefore be a small “u” so that it corresponds to the Java Convention.
  2. Your input parameter radius has no type. Is it an int? … The type must always be specified, as with the other methods.