• java第六天


     p37

    1、java ant详解

    练习8

    /**
     * Created by xkfx on 2017/2/26.
     */
    class A {
        static int i = 47;
    }
    public class TestStatic {
        public static void main(String[] args) {
            A a1 = new A();
            A a2 = new A();
            A a3 = new A();
            a2.i++;
            a3.i++;
            System.out.println(a1.i);   // 并没有直接通过a1来改变i
        }
    }

    练习9

    /**
     * Created by xkfx on 2017/2/26.
     */
    public class Test {
        public static void main(String[] args) {
            Boolean b = true;
            boolean b1 = b;
            System.out.println(b1);
    
            Character ch = 'x';
            char c = ch;
            System.out.println(c);
    
            Byte by = 1;
            byte b2 = by;
            System.out.println(b2);
    
            Integer in = 1;
            int k = in;
            System.out.println(k);
        }
    }

    不用写全部吧。。。

    练习10

    /**
     * Created by xkfx on 2017/2/26.
     */
    public class Test {
        public static void main(String[] args) {
            for (int i = 0; i < args.length; ++i) {
                System.out.println(args[i]);
            }
        }
    }

    测试示例:

    mdzz@LAPTOP-QGECNCGO MINGW64 /d/Projects/untitled/src
    $ java Test 1 2 Hello
    1
    2
    Hello

    练习11

    /**
     * Created by xkfx on 2017/2/26.
     */
    public class ALLTheColorsOfTheRainbow {
        int anIntegerRepresentingColors;
        void changeTheHueofTheColor(int newHue) {
            this.anIntegerRepresentingColors = newHue;
        }
        public static void main(String[] args) {
            ALLTheColorsOfTheRainbow x = new ALLTheColorsOfTheRainbow();
            x.changeTheHueofTheColor(17);
            System.out.println(x.anIntegerRepresentingColors);
        }
    }
  • 相关阅读:
    python 操作mysql
    python多线程
    python socket 网络编程
    nginx源码编译安装
    CentOS网卡配置文件
    使用本地yum源
    ping github 请求超时
    ping github 请求超时
    设计模式-装饰器模式
    设计模式-装饰器模式
  • 原文地址:https://www.cnblogs.com/xkxf/p/6446049.html
Copyright © 2020-2023  润新知