am new to java we just started it about a month ago in our oracle class. our instructor gave us a tetris game to do and i guess he must have printed it wrong because i keep getting this error.
symbol : method moveLines (int)
moveLines(y);
^
.. i have no idea what i have done wrong.. i have looked over this 6 page assignment and everything he has i have typed in correctly. if anyone knows anything would greatly appreciate it. thanks
here is more of the project if this helps
public void checkLines(){
int y=15;
boolean filled;
while(y>1){
filled=true;
for(int x=1;x<16;x++)
if(gameboard[x][y]==0) {filled=false;break;}
if(filled)
moveLines(y);
else
y--;}
}
Cannot Resolve Symbol .. Method Movelines
Started by
johnmcgrady
, Mar 24 2005 01:02 AM
10 replies to this topic
#1
Posted 24 March 2005 - 01:02 AM
#2
Posted 24 March 2005 - 02:17 AM
do you have moveLines() defined in the same class?
no point making your program so simple a dummy can use it cause the universe just keeps making a better dummy!
#3
Posted 24 March 2005 - 02:28 AM
QUOTE(jeef @ Mar 23 2005, 09:17 PM)
symbol : method moveLines (int)
location: class tetris
Note: C:\Program Files\Xinox Software\JCreator LE\MyProjects\tetris.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
1 error
thats pretty much my error report. sorry if this is a dumb question. like i said we have been only doing this for about a month now, and my instructor hasn't really explained this stuff to us. and since its now spring break i have to have this done when i get back and what he left us to do seems to have an error. anything that could help i would greatly appreciate.
#4
Posted 24 March 2005 - 03:58 AM
hmm, it looks like you are using some depreciated methods... but that wont cause it to not work.
do you have the definition for the 'moveLines()' method? or, is your class extending anything?
ie, your whole progrm might look like:
public class tetris {
public void checkLines() {
//this is your checkLines() method
}
public void moveLines() {
//is your moveLines() method here??
}
}
you will need the moveLines() method in there for it to find it. Also, may I may come code tidying suggestions:
public class tetris {
public void checkLines() {
int y=15;
boolean filled;
while(y>1) {
filled=true;
for(int x=1;x<16;x++) {
if(gameboard[x][y]==0) {
filled=false;
break;
}
if(filled)
moveLines(y);
else
y--;
}
}
}
do you have the definition for the 'moveLines()' method? or, is your class extending anything?
ie, your whole progrm might look like:
CODE
public class tetris {
public void checkLines() {
//this is your checkLines() method
}
public void moveLines() {
//is your moveLines() method here??
}
}
you will need the moveLines() method in there for it to find it. Also, may I may come code tidying suggestions:
CODE
public class tetris {
public void checkLines() {
int y=15;
boolean filled;
while(y>1) {
filled=true;
for(int x=1;x<16;x++) {
if(gameboard[x][y]==0) {
filled=false;
break;
}
if(filled)
moveLines(y);
else
y--;
}
}
}
no point making your program so simple a dummy can use it cause the universe just keeps making a better dummy!
#5
Posted 24 March 2005 - 04:46 AM
QUOTE(jeef @ Mar 23 2005, 10:58 PM)
hmm, it looks like you are using some depreciated methods... but that wont cause it to not work.
do you have the definition for the 'moveLines()' method? or, is your class extending anything?
ie, your whole progrm might look like:
public class tetris {
public void checkLines() {
//this is your checkLines() method
}
public void moveLines() {
//is your moveLines() method here??
}
}
you will need the moveLines() method in there for it to find it. Also, may I may come code tidying suggestions:
public class tetris {
public void checkLines() {
int y=15;
boolean filled;
while(y>1) {
filled=true;
for(int x=1;x<16;x++) {
if(gameboard[x][y]==0) {
filled=false;
break;
}
if(filled)
moveLines(y);
else
y--;
}
}
}
do you have the definition for the 'moveLines()' method? or, is your class extending anything?
ie, your whole progrm might look like:
CODE
public class tetris {
public void checkLines() {
//this is your checkLines() method
}
public void moveLines() {
//is your moveLines() method here??
}
}
you will need the moveLines() method in there for it to find it. Also, may I may come code tidying suggestions:
CODE
public class tetris {
public void checkLines() {
int y=15;
boolean filled;
while(y>1) {
filled=true;
for(int x=1;x<16;x++) {
if(gameboard[x][y]==0) {
filled=false;
break;
}
if(filled)
moveLines(y);
else
y--;
}
}
}
no i dont have a public void movelines method.. its all in the public void checkLines ... from the code i showed u do i need to put it in there?
#6
Posted 24 March 2005 - 08:23 AM
yeah you'll definately need to have it defined somewhere in your tetris class. just follow jeef's little block of code there for defining the moveLines(int) method. the only other explaination i can think of would be if you have some other thread/object to take care of moving stuff, but i highly doubt that your instructor would start you out on threads a month into the language.
#7
Posted 24 March 2005 - 03:26 PM
got the moveLines method in .. no errors .. thanks all
now when i try to run the program i get an error on the command prompt
Exception in thread "main" java.lang.NoSuchMethodError: main
Press any key to continue...
i have the code up on my site.. if someone could tell me what i'm missing here i would be very greatful. once again thanks
http://mysite.verizon.net/johnmcgrady/tetris.html
now when i try to run the program i get an error on the command prompt
Exception in thread "main" java.lang.NoSuchMethodError: main
Press any key to continue...
i have the code up on my site.. if someone could tell me what i'm missing here i would be very greatful. once again thanks
http://mysite.verizon.net/johnmcgrady/tetris.html
#8
Posted 24 March 2005 - 03:41 PM
the code is OK, but since you have created an Applet, it needs to be run from a browser or AppletViewer.
add the file tetris.html to your project and put this code in:
make sure the code = "tetris.class" points to the right dir/file and it should work (tested it here).
the game works by the way.
add the file tetris.html to your project and put this code in:
CODE
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="000000">
<CENTER>
<APPLET
code = "tetris.class"
width = "500"
height = "300"
>
</APPLET>
</CENTER>
</BODY>
</HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="000000">
<CENTER>
<APPLET
code = "tetris.class"
width = "500"
height = "300"
>
</APPLET>
</CENTER>
</BODY>
</HTML>
make sure the code = "tetris.class" points to the right dir/file and it should work (tested it here).
the game works by the way.
"Many are persistently in pursuit of the way they have chosen; few in pursuit of the goal"
#9
Posted 24 March 2005 - 04:01 PM
thanks that worked..
just wanna thank everyone who replied to my questions, you guys helped me out big time
once again thanks!
just wanna thank everyone who replied to my questions, you guys helped me out big time
once again thanks!
#10
Posted 24 March 2005 - 10:01 PM
glad your program came together for ya. i don't know how many programs i've started off well and then end with me opening up my case and punching the motherboard...
#11
Posted 25 March 2005 - 12:13 AM
i didnt realise it was an applet?
if you want to run from the command line you will need the main() method like this:
//must be defined like this
public static void main(String args[]) {
//fire up a new object of your class
new tetris();
}
theres some other bits that you should have in their to "schedule" the start of the app but that should work like that. If you add that you wont get the error you got
if you want to run from the command line you will need the main() method like this:
CODE
//must be defined like this
public static void main(String args[]) {
//fire up a new object of your class
new tetris();
}
theres some other bits that you should have in their to "schedule" the start of the app but that should work like that. If you add that you wont get the error you got
no point making your program so simple a dummy can use it cause the universe just keeps making a better dummy!











