```java
public class Demo2{
//成员方法
public void show(){
int number=10;//局部变量
System.out.println("number is"+number);
}
public void show2(){
int number=20000;//局部变量
System.out.println("number is"+number);
}
//主方法
public static void main(String[]args){
//创建对象
Demo d=new Demo();
//调用方法
d.show();
d.show2();
}
}
error: cannot find symbol
d.show2();
^
symbol: method show2()
location: variable d of type Demo
1 error
```
你new的类错了,是Demo2
//创建对象
Demo2 d=new Demo2();
你新建的类叫作Demo2 但是你在main方法里创建的是Demo的对象,这显然不一样。除非,你还有一个叫Demo的类