TreeMap

package by;

import java.util.TreeMap;

public class TreeMap1 {
    public static void main(String[] args) {
        TreeMap<String,Integer> treeMap = new TreeMap();
        System.out.println("初始化,TreeMap元素个数为:" +treeMap.size());
        treeMap.put("hello",1);
        treeMap.put("world",2);
        treeMap.put("my",3);
        treeMap.put("name", 4);
        treeMap.put("is", 5);
        treeMap.put("huangqiuping", 6);
        treeMap.put("i", 6);
        treeMap.put("am", 6);
        treeMap.put("a", 6);
        treeMap.put("developer", 6);
        System.out.println("添加元素后,TreeMap元素个数为:"+treeMap.size());
        System.out.println(treeMap);
        System.out.println(treeMap.keySet());
        System.out.println(treeMap.values());

    }
}

基础练习

package hm;

import java.util.Scanner;

public class Math {
    public static void main(String[] args) {
        System.out.println(1.2F + 1.02F);
        System.out.println(20/3F);
        System.out.println(20%2);
        System.out.println(20%3F);
        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个三位数");
        int number = sc.nextInt();
        int ge = number % 10;
        int shi = number / 10 % 10;
        int bai = number / 100 % 10;
        System.out.println(ge);
        System.out.println(shi);
        System.out.println(bai);
        int a =10;
        double b = 20.0;
        System.out.println(a +b);
        byte b = 1 ;
        byte b1 = 1 ;
     byte c =(byte) (b +b1);
        System.out.println(c);
        System.out.println(1.6+"adf");
        int a = 10;
        a++;
        System.out.println(a);
        ++a;
        System.out.println(a);
        a--;
        System.out.println(a);
        --a;
        System.out.println(a);
        int  i =10;
        int y = i++;
        int z = y++;
        System.out.println(i);//11
        System.out.println(y);//11
        System.out.println(z);//10
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入我们自己的时髦程度");
        int myFashion = sc.nextInt();
        System.out.println("请输入相亲对象的时髦程度");
        int girFashion = sc.nextInt();
        if (myFashion > girFashion) {
            System.out.println("相亲成功");
        } else {
            System.out.println("相亲失败");
        }

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一只老虎的体重");
        int tager1 = sc.nextInt();
        System.out.println("请输入第二只老虎的体重");
        int tager2 = sc.nextInt();
        String result = tager1 == tager2 ? "相同" : "不同";
        System.out.println(result);

        int height1 = 210;
        int height2= 179;
        int height3 = 159;
        int i = height1 > height2 ? height1 : height2;
        int  j = i > height3 ? i : height3;
        System.out.println(j);

    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值