黑马程序员技术交流社区

标题: java基础 [打印本页]

作者: lpingping    时间: 2018-6-16 20:32
标题: java基础
public class Lianxi {
    public static void main(String[] args) {
        String rng ="ska36345asdkdfjaljksf";
        char[] we = rng.toCharArray();
        Arrays.sort(we);
        for (int i = we.length-1; i >= 0; i--) {
            System.out.println(we[i]);
        }

    }
}


public class Lianxi01 {
    public static void main(String[] args) {
        int num = 0;
        double max = 5.9;
        double min = -10.8;
        for (double a = min; a < max; a++) {
            double b = Math.abs(a);
            if (b > 6.0 || b < 2.1) {
                num++;
            }
        }
        System.out.println("总共有"+ num);
    }
}


public class Phone {
    private String brand;
    private String price;
    static int size = 6;

    public Phone() {

    }

    public Phone(String brand, String price) {
        this.brand = brand;
        this.price = price;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public void call() {
        System.out.println("打电话");
    }

    public void sendMessage() {
        System.out.println("发短信");
    }

    public void playGame() {
        System.out.println("打游戏");
    }
}


public class Liangxi {
    public static void main(String[] args) {
        String edg = we();
        System.out.println(edg);
    }

    public static String we(){
        int[] rng = {1, 2, 3};
        String ig = "[";
        for (int i = 0; i < rng.length; i++) {
            if (i == rng.length - 1) {
                ig += "]";
            } else {
                ig += "world" + rng[i] + "#";
            }
        }
        return ig;
    }
}



作者: 小浙姐姐    时间: 2018-6-17 15:21
加油哦




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2