Thinking in Java notebook

import  java.util. * ;
import  java.io. * ;
/** */ /**A class comment*/
public   class  Test
{    
    
/**//*
    public static void main(String[] args)
    {
        double i = 0;
        while(i<0.99d)
        {
            i =  Math.random();
            System.out.println(i);
        }
    }
*/

    
/**//*
    public static void main(String[] args)
    {
        for(int i=0;i<128;i++)
            if(Character.isLowerCase((char)i))
                System.out.println("value:"+i+"char:"+(char)i);
    }
*/

    
/**//*
    public static void main(String[] args)
    {
        for(int i=1,j=i+10;i<5;i++,j=i*2)
        {
            System.out.println("i="+i+"j="+j);
        }
    }
*/

    
public static void main(String[] args)
    
{
        
//new BreakAndContinue();
        
//new LableFor();
        
//new SwitchTest();
        /**//*
        OverLoading ol = new OverLoading();
        ol.testConstVal();
        ol.testChar();
        ol.testByte();
        ol.testShort();
        ol.testInt();
        ol.testLong();
        ol.testFloat();
        ol.testDouble();
*/

        
/**//*
        ThisTest1 tt = new ThisTest1();
        tt.increment().increment().increment().increment().print();
*/

        
//ThisTest2 tt = new ThisTest2();
        /**//*
        Bath b = new Bath();
        System.out.println(b);
*/

        
/**//*
        Detergent d = new Detergent();
        d.dilute();d.apply();d.scrub();d.foam();
        System.out.println(d);
        System.out.println("Testing base class");
*/

        
//Cartoon c = new Cartoon();
        
//Chess c = new Chess();
        
//PlaceSetting ps = new PlaceSetting(2);
        
//CADSystem cs = new CADSystem(8);
        /**//*
        Bart b = new Bart();
        b.doh(1);
        b.doh('x');
        b.doh(1.0f);
        b.doh(new Milhouse());
*/

        
/**//*
        Orc o = new Orc("bulktree",23);
        System.out.println(o);
        o.change("oakertree",22);
        System.out.println(o);
*/

        
//Beetle b = new Beetle();
        /**//*
        RandomShapeGenerator rsg = new RandomShapeGenerator();
        Shape[] s = new Shape[9];
        for(int i=0;i<s.length;i++)
            s[i] = rsg.next();
        for(int i=0;i<s.length;i++)
            s[i].draw();
*/

        
/**//*
        Instrument[] i = new Instrument{
            new Wind(),
            new Percussion(),
            new Stringed(),
            new Brass(),
            new WoodWind()
            };
*/

        
//new Sandwich();
        /**//*
        System.out.println(RandVals.randomInt);
        System.out.println(RandVals.randomLong);
        System.out.println(RandVals.randomFloat);
        System.out.println(RandVals.randomDouble);
*/

        
/**//*
        A a = new A();
        A a2 = new A();
        a2.receiveD(a.getD());
*/

        
/**//*
        Parcel1 p = new Parcel1();
        p.ship("xiangtan");
        p.ship("湘潭");
*/

        
/**//*
        Parcel2 p = new Parcel2();
        p.ship("湘潭");
        Parcel2 q = new Parcel2();
        Parcel2.Contents c = q.getContents();
        Parcel2.Destination d = q.getDestination("南方");
        d.readLabel();
*/

        
/**//*
        MNA mna = new MNA();
        mna.f();
        MNA.A mnaa = mna.new A();
        mnaa.g();
        MNA.A.B mnaab = mnaa.new B();
        mnaab.h();
*/

        
/**//*
        WithInner wi = new WithInner();
        InheritInner ii = new InheritInner(wi);
*/

        
/**//*
        Callee1 c1 = new Callee1();
        Callee2 c2 = new Callee2();
        MyIncrement.f(c2);
        Caller caller1 = new Caller(c1);
        Caller caller2 = new Caller(c2.getCallbackReference());
        caller1.go();
        caller1.go();
        caller2.go();
        caller2.go();
*/

        
/**//*
        try
        {
            ExtraFeatures.f();
        }
        catch(MyException e)
        {
            e.printStackTrace();
        }
        try
        {
            ExtraFeatures.g();
        }
        catch(MyException e)
        {
            e.printStackTrace();
        }
        try
        {
            ExtraFeatures.h();
        }
        catch(MyException e)
        {
            e.printStackTrace();
            System.out.println("e.val()="+e.val());
        }
*/

        
//new ArraySize();
        /**//*
         new IceCream();
         for(int i=0;i<20;i++)
             System.out.println("flavorSet("+i+")=");
         String[] f1 = flavorSet(flavors.length);
         for(int j=0;j<fl.length;j++)
             System.out.println("\t"+f1[j]);
*/

         
/**//*
         System.out.println(PrintCollection.fill(new ArrayList()));
         System.out.println(PrintCollection.fill(new HashSet()));
         System.out.println(PrintCollection.fill(new HashMap()));
*/

         
//new FillingLists();
         /**//*
         List list = new ArrayList();
         for(int i=0;i<3;i++)
         {
             list.add(new Hamster(i));
             System.out.println(list.iterator().next());
         }
*/

         
//new SimpleCollection();
         /**//*
         try
         {
             new IOStreamDemo();
         }
         catch(IOException e)
         {
             e.printStackTrace();
         }
*/

         
try
         
{
             
new StreamTest();
         }

         
catch(IOException e)
         
{
             System.out.println(e);
         }

         
    }

}

/**/ /*
class BreakAndContinue
{
    
    BreakAndContinue()
    {
        for(int i=0;i<100;i++)
        {
            if(i==74)
                break;                
            if(i%9!=0)
                continue;
            System.out.println("i="+i);
        }
        int i = 0;
        while(true)
        {
            i++;
            int j = i*27;
            if(j==1269)
                break;
            if(i%10!=0)
                continue;
            System.out.println("i="+i);
        }
    }        
}
*/

/**/ /*
class LableFor
{
    LableFor()
    {
        int i=0;
        outer:
        for(;true;)
        {
            inner:
            for(;i<10;i++)
            {
                System.out.println("i="+i);
                if(i==2)
                {
                    System.out.println("continue");
                    continue;
                }
                if(i==3)
                {
                    System.out.println("break");
                    i++;
                    break;
                }
                if(i==7)
                {
                    System.out.println("continue outer");
                    i++;
                    continue outer;
                }
                if(i==8)
                {
                    System.out.println("break outer");
                    break outer;
                }
                for(int k=0;k<5;k++)
                {
                    if(k==3)
                    {
                        System.out.println("continue inner");
                        continue inner;
                    }
                }
            }
        }
    }
}
*/

/**/ /*
class SwitchTest
{
    SwitchTest()
    {
        for(int i=0;i<100;i++)
        {
            char c = (char)(Math.random()*26+'a');
            System.out.println(c+":");
            switch(c)
            {
                case 'a':
                case 'e':
                case 'i':
                case 'o':
                case 'u':
                    System.out.println("vowel");
                    break;
                case 'y':
                case 'w':
                    System.out.println("sometime a vowel");
                    break;
                default: 
                    System.out.println("consonant");
            }
        }
    }
}
*/

/**/ /*
class OverLoading
{
        void f1(char x)
        {
            System.out.println("f1(char)");
        }
        void f1(byte x)
        {
            System.out.println("f1(byte)");
        }
        void f1(short x)
        {
            System.out.println("f1(short)");
        }
        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值