انجمن سایت کلیدستان


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
مشکل در کد های جاوا

مشکل در کد های جاوا

#1
سلام یه مشکلی پیش اومد وقتی داشتم کد میزدم اگه میشه راهنمایی کنید!
ارور های زیر رو دریافت میکنم 
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 : 

       

}



}

}}
پاسخ

مشکل در کد های جاوا

#2
دادا چرا اینجور نوشتی اصن معلوم نیست چی گفتی
پاسخ

مشکل در کد های جاوا

#3
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 :



}



}
پاسخ

مشکل در کد های جاوا

#4
فک میکنم شما داخل یک متد

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

باید متد جدیدت رو خارج از بلاک متد های دیگه بنویسی
پاسخ
 سپاس شده توسط شماره مجازی امارات ، تلگرام ضد فیلتر 2023


پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان