Java的课后作业——18.10.18
日期:2018.10.18
星期四
博客期:020
小试验任务:
我就发一下代码好了!!!
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 package test1; 2 3 import java.util.Scanner; 4 5 public class Aobj { 6 public static int num = 0; 7 public static void setOff(){ 8 System.out.println(num); 9 } 10 public void Run(){ 11 12 } 13 //构造方法 14 public Aobj(){ 15 num++; 16 } 17 //主方法 18 public static void main(String[] args) { 19 Aobj t = new Aobj(); 20 Aobj.setOff(); 21 Scanner sc = new Scanner (System.in); 22 int N = sc.nextInt(); 23 Aobj []m = new Aobj[N]; 24 for(int i=0;i<N;++i) 25 m[i] = new Aobj(); 26 t.Run(); 27 Aobj.setOff(); 28 } 29 }
说截图: