请问这段代码怎么错了?
public class Demo {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		MyThis a = new MyThis();  
         a.setId(12);
         a.getId();          
         MyThis b = new MyThis();
         b.setId(13);
         b.getId();
	}
class MyThis{
	private int id;	
	public void setId(int id){
		this.id = id;
	}	
	public void getId(){
		System.out.println(this.id);
	}
}	
}
------解决方案--------------------
MyThis类你现在定义成Demo的内部类了。因而代码这样写是不对的。
改正方法:
方法一:将MyThis类从Demo类中移出来。不定义为内部类。
方法二:若一定要定义成内部类,则代码改成:
Demo d = new Demo();
MyThis a = d.new MyThis();  
及MyThis b= d.new MyThis();