کلیدستان

نسخه‌ی کامل: مشکل در کد های جاوا
شما در حال مشاهده نسخه آرشیو هستید. برای مشاهده نسخه کامل کلیک کنید.
سلام یه مشکلی پیش اومد وقتی داشتم کد میزدم اگه میشه راهنمایی کنید!
ارور های زیر رو دریافت میکنم 
Multiple markers at this line
- This method requires a body instead of a 
 semicolon
- Duplicate method setcolors() in type 
 GameView
- Return type for the method is missing
----------------------------------
اینم دومی 
Multiple markers at this line
- This method requires a body instead of a 
 semicolon
- Duplicate method setcolors() in type 
 GameView
- Return type for the method is missing
 

این هم کد هام (ارور ها مربوط به خط یک و دو هست)

 setcolors();

private void setcolors(){

for (int x = 0; x < 4; x++) {

for (int y = 0; y < 4; y++) {

int count = cardsMap[x][y].getNum();

switch(count){

   case 2 :

    cardsMap[x][y].setBackgroundResource(R.color.red);

    break; 

   case 4 :

       

    break; 

   case 8 :

       

   break; 

   case 16 :

       

   break; 

   case 32 :

       

   break; 

   case 64 :

       

   break; 

   case 128 :

       

   break; 

   case 256 :

       

   break; 

   case 512 :

       

   break; 

   case 1024 :

       

   break; 

   case 2048 :

       

   break; 

   case 4096 :

       

   break;

   case 8192 :

       

   break; 



   case 16384 :

       

   break; 

   default : 

       

}



}

}}
دادا چرا اینجور نوشتی اصن معلوم نیست چی گفتی
Multiple markers at this line
- This method requires a body instead of a
semicolon
- Duplicate method setcolors() in type
GameView
- Return type for the method is missing
----------------------------------

Multiple markers at this line
- This method requires a body instead of a
semicolon
- Duplicate method setcolors() in type
GameView
- Return type for the method is missing

این دو ارور رو تو خط یک و دو کد زیر دریافت میکنم


setcolors();

private void setcolors(){

for (int x = 0; x < 4; x++) {

for (int y = 0; y < 4; y++) {

int count = cardsMap[x][y].getNum();

switch(count){

case 2 :

cardsMap[x][y].setBackgroundResource(R.color.red);

break;

case 4 :



break;

case 8 :



break;

case 16 :



break;

case 32 :



break;

case 64 :



break;

case 128 :



break;

case 256 :



break;

case 512 :



break;

case 1024 :



break;

case 2048 :



break;

case 4096 :



break;

case 8192 :



break;



case 16384 :



break;

default :



}



}
فک میکنم شما داخل یک متد

متد جیدی تعرف کردی

باید متد جدیدت رو خارج از بلاک متد های دیگه بنویسی