Java实用类小练习

这里写图片描述

package ArrayTest;

import java.util.Random;

public class TEST {
    static int and;
    static int and1;
    static int Sand;
    static int c;

    public static void main(String[] args) {
        // 内容1
        Integer i = new Integer(25);
        System.out.println(i.intValue());
        // 内容2
        Character c1 = new Character('A');
        Character c2 = new Character('B');
        System.out.println("char大写类型" + c1.equals(c2));
        c1.toLowerCase(c1);
        c2.toLowerCase(c2);
        System.out.println("char小写类型" + c1.equals(c2));
        // 内容3
        String booleans = "boolean";
        Boolean boo = new Boolean(booleans);
        String str = boo.toString();
        System.out.println("Boolean类型转换String类型是否等于原来" + str.equals(booleans));
        // 内容4
        Random ran = new Random();
        for (int j = 0; j < 6; j++) {
            int intv = ran.nextInt(30) + 1;
            if (intv % 2 != 0) {
                c = intv + 1;
                System.out.println(c);
                and += c;
            } else {
                System.out.println(intv);
                and1 += intv;
            }
            Sand = and + and1;
        }
        System.out.println("偶数总和:"+Sand);
        //内容5
        double r=5;
        double and1=(r*r)*Math.PI;
        String And=Double.toString(and1);
        System.out.println("圆面积保留5位小数:"+And.format("%.5f",and1 ));
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值