2011年8月5日 星期五

[java] (8) create class and call by another program


package abc;



public class motor{



private int num;

private double oil;



public motor(){



System.out.println("happy");



}



}



package abcd{ <-- belong package abcd



public static void main(String[] args){

abc.motor good = new abc.motor();<-- first call package and second call class

good.motor();


}



}

0 意見:

張貼留言