我是java新手,我在记事本中编写这段代码,这给了我错误。在netbeans中虽然已经定义了包。如何在记事本中做到这一点?
package A;
class A {
private String name;
protected String company="oracle";
A(String name) {
this.name = name;
System.out.println(name);
}
}
public class B extends A {
// A public class constant
public final static String st = "Public access modifiers";
B(String name) {
super(name);
}
void getCompany()
{
System.out.println(company);
}
}
package B;//getting class interface or enum expected
public class Application {
public static void main(String[] args) {
System.out.println(st);
B b=new B("Java");
b.getCompany();
}
}