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

的关系

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

相关推荐
Java面试题总结1 分钟前
Spring Boot:别再重复造轮子,这些内置功能香麻了
java·spring boot·后端
迷糊小白告9 分钟前
Java微服务——SpringCloud
java·spring cloud·微服务
qq_269870439 分钟前
java rabbitmq 队列在Springboot的设计
java·rabbitmq·java-rabbitmq
abcnull19 分钟前
Springboot+Vue2的Web项目小白入门Demo快速学习!
java·elementui·vue·maven·springboot·web·小白
2501_9327502624 分钟前
Java IO流基础全面详解:字节流、字符流
java·开发语言
逸Y 仙X31 分钟前
文章二十二:ElasticSearch EQL事件查询语言
java·大数据·elasticsearch·搜索引擎·全文检索
liulilittle34 分钟前
LLAMA-CLI 运行千问3.6(R9-7945HX+64G+RTX40608G)
java·前端·llama
后端漫漫39 分钟前
Redis 键值对序列化
java·redis
Lenyiin1 小时前
《LeetCode 顺序刷题》61 - 70
java·c++·python·算法·leetcode·lenyiin
敲代码的瓦龙1 小时前
Android?基础UI控件!!!
java·开发语言