java - Can not find symbol -
so far, i've been reading, error has main class not being able access juego class. can't instantiate "juego" nor "tablero" class object. how can fix error? i'm sure must i'm overlooking, haven't been able figure out.
i'm stumbling upon error reads:
c:\users\pabloeugenio\desktop\memoria\gamedriver.java:7: error: cannot find symbol public class gamedriver extends juego{ ^ symbol: class juego c:\users\pabloeugenio\desktop\memoria\gamedriver.java:10: error: cannot find symbol juego j; ^ symbol: class juego location: class gamedriver c:\users\pabloeugenio\desktop\memoria\gamedriver.java:11: error: cannot find symbol j = new juego(); ^ symbol: class juego location: class gamedriver 3 errors [finished in 0.5s exit code 1]
the program consists in 3 java classes in package memoria,; juego.java, tablero.java, , gamedriver.java.
//gamedriver // // cd c:\users\pabloeugenio\desktop\memoria // package memoria; public class gamedriver extends juego{ public static void main(string []args){ juego j; j = new juego(); } }
here juego class:
//class juego package memoria; public class juego{ int[][] tab; int count; int aux, x, y; int comp; public juego(){ count = 1; comp = 0; //initialize int[][] tab = {{1,1,2,2},{3,3,4,4},{5,5,6,6},{7,7,8,8}}; //shuffles array for(int k=0; k<2;k++){ for(int i=0; i<4;i++){ for(int j=0; j<4; j++){ x = (int)(math.ceil(math.random()*3)); y = (int)(math.ceil(math.random()*3)); aux = tab[i][j]; tab[i][j] = tab[x][y]; tab[x][y] = aux; } } } //output array for(int i=0;i<4;i++){ for(int j=0;j<4;j++){ system.out.println(tab[i][j]); } } }//ends juego //returns value in array public int getvalue(int x, int y){ return tab[x][y]; }//getvalue ends //nullify //gives 0 value coordinate in array public void nullify(int x, int y){ tab[x][y]=0; }//nullify ends }
here tablero class:
package memoria; import javax.swing.*; import java.awt.*; import java.awt.event.actionlistener; import java.awt.event.actionevent; public class tablero extends jframe{ //declare imageicons, labels, , frames imageicon back, carta1, carta2, carta3, carta4, carta5, carta6, carta7, carta8; jlabel l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16; jframe frame; public void tablero(){ frame = new jframe("memoria!"); // initialize imageicons put them later in labels back=new imageicon("images/back.gif"); carta1=new imageicon("images/carta1.gif"); carta2=new imageicon("images/carta2.gif"); carta3=new imageicon("images/carta3.gif"); carta4=new imageicon("images/carta4.png"); carta5=new imageicon("images/carta5.gif"); carta6=new imageicon("images/carta6.gif"); carta7=new imageicon("images/carta7.png"); carta8=new imageicon("images/carta8.gif"); //initialize labels no text on 'em l1=new jlabel(""); l2=new jlabel(""); l3=new jlabel(""); l4=new jlabel(""); l5=new jlabel(""); l6=new jlabel(""); l7=new jlabel(""); l8=new jlabel(""); l9=new jlabel(""); l10=new jlabel(""); l11=new jlabel(""); l12=new jlabel(""); l13=new jlabel(""); l14=new jlabel(""); l15=new jlabel(""); l16=new jlabel(""); //gridlayout de 4x4 , add labels frame frame.setlayout(new gridlayout(4,4)); frame.setsize(800, 800); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setvisible(true); frame.add(l1); frame.add(l2); frame.add(l3); frame.add(l4); frame.add(l5); frame.add(l6); frame.add(l7); frame.add(l8); frame.add(l9); frame.add(l10); frame.add(l11); frame.add(l12); frame.add(l13); frame.add(l14); frame.add(l15); frame.add(l16); } }
Comments
Post a Comment