//First.java
package abc;
public class First
{
protected int value;
public First()
{
value =10;
}
}
//Second.java
package abc;
public class Second
{
public Second(){}
public void print()
{
First app = new First();
System.out.println(app.value);
}
}
//TestFS.java
import abc.First;
import abc.Second;
public class TestFS
{
public TestFS()
{
}
public static void main(String args[])
{
Second s = new Second();
s.print();
}
}
---------------------------------------------------------------
javac -d . First.java
javac -d . Second.java
javac TestFS.java
java TestFS
沒有留言:
張貼留言