zoukankan      html  css  js  c++  java
  • java第五天

    p37:

    练习1

    /**
     * Created by xkfx on 2017/2/22.
     */
    public class DataOnly {
        int anInt;
        char aChar;
        public static void main(String[] args) {
            DataOnly dateOnly = new DataOnly(); // 静态方法中无法直接打印成员数据,需要先new一个对象
            System.out.println(dateOnly.anInt + " " + dateOnly.aChar);
        }
    }

    练习2

    /**
     * Created by xkfx on 2017/2/22.
     */
    public class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello, World"); // System类位于默认导入的java.lang包中,out是该类的静态成员,可以通过类名直接使用。
        }
    }

    练习3

    /**
     * Created by xkfx on 2017/2/22.
     */
    public class ATypeName {
        public static void main(String[] args) {
            ATypeName a = new ATypeName();  // 这个内容在书的第25页
        }
    }

    练习4、练习5

    class DataOnly {
        int i;
        double d;
        boolean b;
        DataOnly() {
            this.i = 47;
            this.d = 1.1;
            this.b = false;
        }
        public static void main(String[] args) {
            DataOnly dataOnly = new DataOnly();
            System.out.println(dataOnly.i + " " + dataOnly.d + " " + dataOnly.b);
        }
    }

    练习6

    /**
     * Created by xkfx on 2017/2/22.
     */
    public class TestStorage {
        static int storage(String s) {
            return s.length() * 2;
        }
        public static void main(String[] args) {
            int length = TestStorage.storage("Not a hello world.");
            System.out.println(length);
        }
    }

    练习7

    /**
     * Created by xkfx on 2017/2/22.
     */
    class Incrementable {
        static void increment() { StaticTest.i++; }
    }
    class StaticTest {
        static int i = 47;
        public static void main(String[] args) {
            Incrementable.increment();
            System.out.println(i);
        }
    }
  • 相关阅读:
    appium应用切换以及toast弹出框处理
    selenium元素定位方法之轴定位
    基于appium的常用元素定位方法
    基于appium的模拟单点或多点触屏操作
    app自动化测试初体验
    app自动化测试环境搭建之node+appium+ADT+MUMU模拟器
    linux的vi编辑器常用用法一览
    踩过了这些坑,你真的懂python基础吗?
    mysql分页查询
    Jenkins—Master/Slave模式
  • 原文地址:https://www.cnblogs.com/xkxf/p/6431142.html
Copyright © 2011-2022 走看看