常用类晨考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

的关系

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

相关推荐
xcl092511 小时前
北京24小时自助健身房系统软件开发实战:从架构到部署全流程指南
java·spring boot·架构
一 乐13 小时前
动漫书销售商城|基于springboot + vue动漫书销售商城(源码+数据库+文档)
java·数据库·vue.js·spring boot·毕业设计
卓怡学长13 小时前
w214基于jsp知道特产网
java·intellij-idea
步行cgn13 小时前
Spring 注解使用详解
java·spring
一条小小yu13 小时前
Spring IoC的理解
java·后端·spring
落魄实习生14 小时前
Agent Scope Java 2.x 系列【7】工具使用
java·开发语言·ai
旺仔学长 哈哈14 小时前
springboot钓鱼爱好者交流平台APP设计与实现
java·spring boot·mysql·充电桩管理系统
自强的小白15 小时前
核心功能(Service接口)
java·mybatis
乌暮16 小时前
深入理解 Java 泛型:把「万能盒子」用对、用稳
java·开发语言·后端·学习