public class Activity01<Button> extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TextView myTextView=(TextView)findViewById(R.id.myTextView);
        Button myButton=(Button)findViewById(R.id.myButton);
        myTextView.setText("我的第一个TextView");//运行时出错
        myButton.setText("我的第一个Button");//运行时出错
    }
}错误信息如下:
The left-hand side of an assignment must be a variable ;
Syntax error on token "Invalid Character", invalid AssignmentOperator;
Syntax error on token "Invalid Character", ; expected
求高手指教,不胜感激

解决方案 »

  1.   

     Button myButton=(Button)findViewById(R.id.myButton);  myTextView.setText("我的第一个TextView");//运行时出错
      myButton.setText("我的第一个Button")//运行时出错
    不会  中英文符号的问题吧
      

  2.   

      myTextView.setText("我的第一个TextView");//运行时出错
      myButton.setText("我的第一个Button");//运行时出错
    那两个冒号用英文输入时输入,重输一下
      

  3.   

    确实用了中文符号,但改正后还有错误如下
    The method setText(String) is undefined for the type Button
    求指教
      

  4.   

    class Activity01<Button> extends Activity
      

  5.   

    public class Activity01 extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            TextView myTextView=(TextView)findViewById(R.id.myTextView);
            Button myButton=(Button)findViewById(R.id.myButton);//运行时出错
            myTextView.setText("我的第一个TextView");
            myButton.setText("我的第一个Button");
        }
    }
    改正后运行还是出错:
    Button cannot be resolved to a type
      

  6.   

    我没学过JAVA语言,可以说是零基础,求指教啊
      

  7.   

    多谢各位了,在代码前加入import android.widget.Button;
    问题解决