java基本编程

    xiaoxiao2021-03-25  76

    一:定义数组

    数组的元素类型   数组名[ ];

    数组的元素类型[ ]      数组名;

    例:int  a[ ];        a=new  int  [10];         int [ ]  a;       a=new  int [10];         int  a[ ]=new int [10];

    以上都是等价的

    二:编程的格式 class  Hello{  public static void main(String args[]){ System.out.println("你好"); } }

    三:输出1到100的和 class  Example{ public static void main(String argd[]){ int s=0; for(int i=1;i<=100;i++){ s=s+i; } System.out.println(s); } }

    转载请注明原文地址: https://ju.6miu.com/read-34471.html

    最新回复(0)