我是JAva和Android的新手,我正在開發我的第一個測試應用程序。VariableDeclaratorId和錯位
我有這樣的代碼(這是整個代碼):
package test.test;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
int num_seeds = 15 ;
int num_coins = 100 ;
int seed_buy_price = 10 ;
int seed_sell_price = 8 ;
String S_num_seeds = Integer.toString(num_seeds) ;
TextView textView_seeds_current_display = (TextView) findViewById(R.id.textView_seeds_current_display) ;
textView_seeds_current_display.setText(S_num_seeds) ;
}
但是Eclipse顯示我的最後一行的錯誤:在該行 多個標誌 - 令牌「S_num_seeds」語法錯誤,VariableDeclaratorId 令牌 - 令牌上的語法錯誤,錯位的構造(s)
我是新來的Java,我仍然無法理解這一點。請問有人能指點我做錯了什麼?我想我下從這裏忠告:
How to display the value of a variable on the screen
感謝
謝謝。這是我第一個Java項目,我不太明白。你解釋得很好。 – Envite
歡迎來到StackOverflow社區期望的一部分在於,如果它可以幫助你,那麼你「接受」你的問題的答案。爲此,請點擊大綱綠色複選標記。 –
完成。非常感謝。 – Envite