代码1:
package hello;
public class hi
{
int x=30;
}
代码2:
package hello;
public class hii
{
public static void main(String args[])
{
hi ob=new hi();
int u= ob.x+33;
System.out.println(u);
}
}
编译代码2时出错:
error:cannot find symbol
hi ob =new hi();
^
error:cannot find symbol
hi ob =new hi();
^
最佳答案
您必须导入该类:
import hello.hi;
关于java - 尝试使用另一个类中的对象调用用户定义的类时出现符号未找到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62098391/