常用类晨考day15

1.基本数据类型以及对应包装类

Byte Short Integer Long Float Double Boolean Character

2.什么是自动拆箱和装箱,jdk版本有什么要求?代码举

例并标明

Integer a = 100; // 装箱

int b = a; // 拆箱

从JDK1.5才开始支持

3.NumberFormatException是什么异常?代码说明会导致

这种异常的情况

数字格式化异常

Integer i = new Integer("abc");

4.Math类获取随机数的方式,向上取整,向下,四舍五入

Math.random()

Math.ceil()

Math.floor()

Math.round()

5.Random类获取随机数的方式

nextInt()

nextInt(int bounds)

nextFloat()

nextDouble()

nextLong()

nextBoolean()

6.静态常量的写法

static final

7.this和super的区别

this表示当前对象 super表示当前对象中父类的信息

8.写出你知道的String类常用方法

length()

equals()

toString()

equalsIgnoreCase()

toLowerCase()

toUpperCase()

concat()

indexOf()

lastIndexOf()

trim()

substring()

split()

startsWith()

endsWith()

contains()

isEmpty()

replace()

charAt()

toCharArray()

复制代码
format

9.面向对象的特征是什么?详细描述

封装:属性私有 方法公开 降低程序的耦合度 提高代码的重用性

继承:子类继承父类 父类中书写共有的信息 子类中书写独有的信息 子类与父类是is-a

的关系

多态:父类引用指向子类对象 同一个引用类型 指向不同的实例类型

相关推荐
金銀銅鐵5 小时前
[Java] 一个方法最多可以有多少个入参?
java·jvm
哭哭啼5 小时前
JAVA服务问题诊断
java·开发语言·jvm
Sayuanni%35 小时前
SpringBoot 从注解到源码:核心知识点总结
java·spring boot·后端
坚定信念,勇往无前6 小时前
Maven 私有仓库-nexus
java
Minner-Scrapy6 小时前
Scrapy 2.17 源码解析:Scheduler 调度器与磁盘/内存双队列
java·爬虫·python·scrapy·网络爬虫·twisted
晚风醉蝶6 小时前
1-11-奇偶排序-OddEvenSort
java·数据结构·算法
夏天拐跑了西瓜6 小时前
Spring Cloud 微服务实战(三):一个服务挂了,凭什么拖垮整个系统?Sentinel 限流熔断实战
java·spring cloud·微服务
2601_967264287 小时前
Jetpack Compose 实践指南:从入门到进阶
java·学习
m0_587383007 小时前
社区家政系统开发实战:从需求分析到上线部署全指南
java·spring boot·spring·需求分析
凤山老林7 小时前
动态 i18n 体系落地:Spring Boot 多租户热加载与前后端协同实践
java·spring boot·后端·i18n