Jump to content


Cannot Resolve Symbol .. Method Movelines


  • Please log in to reply
10 replies to this topic

#1 johnmcgrady

johnmcgrady

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 24 March 2005 - 01:02 AM

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--;}
}


#2 jeef

jeef

    Advanced Member

  • Members
  • PipPipPip
  • 344 posts
  • Location:New Zealand

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 johnmcgrady

johnmcgrady

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 24 March 2005 - 02:28 AM

QUOTE(jeef @ Mar 23 2005, 09:17 PM)
do you have moveLines() defined in the same class?

View Post




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 jeef

jeef

    Advanced Member

  • Members
  • PipPipPip
  • 344 posts
  • Location:New Zealand

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:

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 johnmcgrady

johnmcgrady

    Newbie

  • Members
  • Pip
  • 5 posts

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:

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--;
   }
 }
}

View Post




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 Lee

Lee

    Member

  • Members
  • PipPip
  • 13 posts
  • Location:pittsburgh, PA

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 johnmcgrady

johnmcgrady

    Newbie

  • Members
  • Pip
  • 5 posts

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

#8 E-E-R

E-E-R

    Advanced Member

  • Members
  • PipPipPip
  • 1,367 posts
  • Gender:Male
  • Location:The Netherlands
  • Interests:Programming, Gaming, DC

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:
CODE
<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 johnmcgrady

johnmcgrady

    Newbie

  • Members
  • Pip
  • 5 posts

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!

#10 Lee

Lee

    Member

  • Members
  • PipPip
  • 13 posts
  • Location:pittsburgh, PA

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 jeef

jeef

    Advanced Member

  • Members
  • PipPipPip
  • 344 posts
  • Location:New Zealand

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:

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!