package com.neu;
class Demo{
public String getInfo() {
return "hello world";
}
}
public class PackageDemo {
public static void main(String[] args) {
System.out.println(new Demo().getInfo());
}
class Demo{
public String getInfo() {
return "hello world";
}
}
public class PackageDemo {
public static void main(String[] args) {
System.out.println(new Demo().getInfo());
}
}
编译:
javac -d . PackageDemo.java
运行:
javacom.neu.PackageDemo.java