首页 > 代码库 > 第四百九十七天 how can I 坚持

第四百九十七天 how can I 坚持

  今天倒是挺忙的,感觉挺舒服,忙点好,闲点容易闲出病。

  倒是学了不少java基础东西,直接上代码吧。这是个弊端,每天一篇将来自己都没有闲功夫看了,谁还会有闲心看你这东西。

  

@Test    public void DerviedTest(){        Dervied derive=new Dervied();        derive.tellName();        System.out.println(0.0/0); //输出NaN        System.out.println(0.0f/0);//输出NaN        System.out.println(0.0f/0.0d);//输出NaN//        System.out.println(0/0);//报异常//        System.out.println(derive.getValue(2)+"");        System.out.println(((Double)null).NaN);//输出NaN        double d1=Double.NaN;        double d2=Double.NaN;        if(d1>d2||d1<=d2){            System.out.println("true");        }else{            System.out.println("false");        }//好神奇 计算机的世界啊    }    @Test    public void Test01(){        int result=0;        int i=2;        switch(i){        case 1:            result=result+i*1;        case 2:            result=result+i*2;        case 3:            result=result+i*3;        }        System.out.println(result);//输出10 因为没有break    }    @Test    public void Test03(){        int i=1231231231;        int j=-1231231231;        System.out.println(i-j);//内存溢出    }
public class NULL {    public static void haha(){        System.out.println("haha");    }    public static void main(String args[]){        ((NULL)null).haha();//null可以转化为任意对象,然后调静态方法。    }}
public class Dervied extends Base{    private String name = "dervied";    public Dervied() {        tellName();        printName();    }    public void tellName() {        System.out.println("Dervied tell name: " +name);    }    public void printName() {        System.out.println("Dervied print name: " +name);    }    public static void main(String[] args){        new Dervied();        /**输出结果是:        Dervied tell name: null        Dervied print name: null        Dervied tell name: dervied        Dervied print name: dervied        */    }}class Base {    private String name = "base";    public Base() {        tellName();        printName();    }    public void tellName() {        System.out.println("Base tell name: " +name);    }    public void printName() {        System.out.println("Base print name: " +name);    }}

哎。。。可怜的基础

第四百九十七天 how can I 坚持