自學Java測試代碼

來源:互聯網
上載者:User

標籤:需要   writer   public   rgs   lis   char   package   logs   ber   

2017-08-22 21:23:37、

writer:pprp

package test;public class helloWorld {     int maxn = 123;     //常量,需要定義一個對象調用     final int MAX = 20;     //類常量,不需要再定義一個對象來調用     static final int MIN = -100;         public static void main(String[] args) {        // TODO Auto-generated method stub        helloWorld p = new helloWorld();        int maxm = 123;        char a = ‘好‘;        char b = ‘不‘;        char c = ‘好‘;        int a1 = 0, a2 = -1000, a3 = 2;        System.out.println("helloWorld");        System.out.println("haobuhaoma~:"+a+b+c);        System.out.println("maxm:" + maxm);        System.out.println("maxn:" + p.maxn);        System.out.println(p.MAX);        System.out.println(MIN);        System.out.println(!(a1 > a2));        System.out.println(a3 << 3);        //無符號右移        System.out.println(a2 >>> 3);        System.out.println(a2 >> 3);                String s[] = {"zhangsan","wangwu","lisi"};        int []nums = {0,1,2,3,4,5,6,7,8,9};        int [] arr = {1,2,3,4,5};        //增強版for迴圈        for(int mm : arr)        {              System.out.println(mm);        }        for(int i = 0 ; i < s.length ; i++)            System.out.println(s[i]);        for(int i : nums)        System.out.println(i);                //一維數組的使用        int [] ans = {3,2,4,3,22,34};        for(int i = 0 ; i < ans.length; i++)            System.out.println(ans[i]);        //二維數組的使用        int binary_arr[][] = new int[4][4];        for(int i = 0 ; i < 4 ; i++)        {            binary_arr[i] = new int[4];        }                System.out.println("------");                for(int i = 0 ; i < 4 ; i++)            for(int j = 0; j < 4 ; j++)            {                binary_arr[i][j] = i * j;            }       for(int j = 0 ; j < 4 ; j++)             for(int i = 0 ; i < 4; i++)            {                System.out.println(binary_arr[i][j]);            }            }    void printnumber()    {        int c = 20;        short y;        int z;        long k;        char d;    }}

 

自學Java測試代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.