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; } }
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.
Thanks, but a problem will be displayed anyway
Is it another mistake or the same?
Yeah, I did. I accidentally copied the wrong one. Now it works thanks to you and the others
Did you remove the semicolon there? With the semicolon that too much, I mean that after the clamp.
The method would be right to make sure that:
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
Thanks a lot, now it works
You have two mistakes: