Results 1 to 4 of 4
Thread: what wrong
- 02-09-2009, 07:25 AM #1
Member
- Join Date
- Apr 2008
- Posts
- 16
- Rep Power
- 0
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
- 02-09-2009, 08:00 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
a class file should has following structure
Java Code:package xxx // if exist import ... // if needed public class XXXNAME{ public XXXNAME(){} // default constructor if needed other methods variables }
- 02-09-2009, 12:42 PM #3
Methods & Constructors
A class needs to contain methods (the methods do all the work). A method that is called when the class is instantiated is called a constructor.
Providing Constructors for Your Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
Defining Methods (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 02-09-2009, 01:07 PM #4
Member
- Join Date
- Aug 2007
- Posts
- 4
- Rep Power
- 0
[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);
}
}
Similar Threads
-
What did i do wrong
By jpnym15 in forum New To JavaReplies: 8Last Post: 11-17-2008, 10:07 AM -
what's wrong in here!!!
By Annatar in forum New To JavaReplies: 8Last Post: 11-14-2008, 02:55 AM -
So, what am I doing wrong?
By Charles_Smith in forum New To JavaReplies: 0Last Post: 10-29-2008, 02:50 PM -
Can someone tell me what I did wrong??
By booter4429 in forum New To JavaReplies: 7Last Post: 08-13-2008, 08:35 PM -
I am Doing Something Wrong But Don't Know What?
By BHCluster in forum New To JavaReplies: 3Last Post: 04-16-2008, 01:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks