-
what wrong
public Balloon(int initialDiameter, int initialX, int initialY) {
diameter = initialDiameter;
xCoord = initialX;
yCoord = initialY;
}
error occur is Balloon.java : 1 : ' class' or ' interface ' expected
public Balloon(int initialDiameter, int initialX, int initialY) {
when i change
public balloon(int initialDiameter, int initialX, int initialY) {
the error still the same >>>Balloon.java : 1 : ' class' or ' interface ' expected
-
a class file should has following structure
Code:
package xxx // if exist
import ... // if needed
public class XXXNAME{
public XXXNAME(){} // default constructor if needed
other methods
variables
}
-
Methods & Constructors
-
[QUOTE=pro85;55264]
you havn't declared any class or interface even you havn't declared the int variables xCoord,yCoord
public class Balloon{
int xCoord=0;
int yCoord=0;
public Balloon(int initialDiameter, int initialX, int initialY) {
diameter = initialDiameter;
xCoord = initialX;
yCoord = initialY;
System.out.println(" values"+xCoord);
System.out.println(" values"+yCoord);
}
}