当前位置:网站首页>Day_ fifteen
Day_ fifteen
2022-06-25 16:26:00 【grp_ grp_ grp】
1. BigInteger
1.1 summary
Integer Class as int The wrapper class , The maximum integer value that can be stored is 231-1,Long Classes are also finite , The maximum is 263-1. If you want to represent a larger integer , Whether it's basic data types or their wrapper classes There's nothing we can do , Not to mention doing calculations
java.math Bag BigInteger Can represent immutable integers of any precision .BigInteger Provide
all Java The equivalent of the basic integer operator of , And provide java.lang.Math All the relevant methods . in addition ,BigInteger The following operations are also provided : Modular arithmetic 、GCD Calculation 、 Prime number test 、 Prime generation 、 Bit operations and some other operations
1.2 Use

Add and + .add

Subtracting the - .subtract

The product of * .multiply

except / .divide

Remainder % .remainder

2. Math
2.1 summary
java.lang.Math A series of static methods are provided for scientific calculation . The parameters and returns of its method
The value type is generally double type
2.2 Common methods

3. Exception mechanism
3.1 Common abnormal
① Null pointer exception
② Subscript out of range exception
③ Type conversion exception
④ Stack memory overflow
3.2 summary
Exception is Java Provides a consistency mechanism for identifying and responding to error conditions . Effective exception handling can make the program more robust 、 Easy to debug , It's a saying that goes wrong
3.3 Abnormal reason
① The user entered illegal data
② The file to be opened does not exist
③ The connection is broken during network communication
④ JVM out of memory
⑤ Some of these exceptions are caused by user errors , Some are caused by program errors , Others are caused by physical errors
3.4 Inheritance system

3.5 Exception
summary :
Exception Is the parent of all exception classes . Divided into non RuntimeException and RuntimeException
Not RuntimeException It refers to the exceptions that need to be caught or handled during program compilation
RuntimeException It refers to the exception that does not need to be caught or handled during program compilation
Common methods :

3.6 try...catch...
try...catch... : Handling exceptions , Generally used for client
Statement :



3.7 throws
throws Throw an exception , This approach does not deal with solving problems , Is a reminder mechanism , Tell the caller , There may be errors here
If guidance on how to solve , Then use try solve the problem , Otherwise, it will pass throws Ask questions as long as the next family reminds you , Either you solve the problem , Otherwise, it will pass throws Throw questions
throws Multiple exceptions can be thrown at the same time , Multiple are separated by commas

3.8 finally
finally : Statement blocks that must be executed , Not to be used alone , It has to be with try perhaps try..catch.. Use it together
finally There is only one case of non execution , That's it System.exit(0);
Statement :

3.9 There can be no broader exceptions
Method override , You cannot have a broader exception than the original method
Exceptions thrown by subclass methods , Cannot be greater than the parent exception , That is, exceptions less than or equal to the parent class can be
4. Custom exception classes
1. Inherit an existing exception class , If it's a runtime exception , Then inherit RuntimeException Otherwise, it inherits Exception Generally speaking , We wrote It must be a compile time exception
2. Public parameterless construction
3. Public parameterized constructs , Parameters are error messages , And then through super Pass it to the parent class

边栏推荐
- Go language - lock operation
- Stop "outsourcing" Ai models! The latest research finds that some "back doors" that undermine the security of machine learning models cannot be detected
- First knowledge of database
- Final, override, polymorphic, abstract, interface
- cmd。。。。。。
- Understanding of reflection part
- Deep learning pytorch cifar10 dataset training "suggestions collection"
- Day21 multithreading
- error Parsing error: Unexpected reserved word ‘await‘.
- Golang open source streaming media audio and video network transmission service -lal
猜你喜欢

Rxjs TakeUntil 操作符的学习笔记

Multiple decorators decorate a function

Resolve the format conflict between formatted document and eslint

Don't underestimate the integral mall, its role can be great!

Record learning of hystrix knowledge --20210929

教务系统开发(PHP+MySQL)

Stop "outsourcing" Ai models! The latest research finds that some "back doors" that undermine the security of machine learning models cannot be detected

Beginner bug set

Educational administration system development (php+mysql)

Lifeifei's team applied vit to the robot, increased the maximum speed of planning reasoning by 512 times, and also cued hekaiming's MAE
随机推荐
Create raspberry PI image file of raspberry pie
【机器学习】基于多元时间序列对高考预测分析案例
leetcode-8. String to integer (ATOI)
What can one line of code do?
About the use of Aidl, complex data transmission
一行代码可以做什么?
ES6 deconstruction assignment rename
说下你对方法区演变过程和内部结构的理解
The database records are read through the system time under the Android system, causing the problem of incomplete Reading Records!
Mixed density network (MDN) for multiple regression explanation and code example
[Third Party framework] retrofit2 (2) - add point configuration of network access framework
Nsurlsession learning notes (III) download task
Catheon Gaming任命Activision Blizzard前亚太区负责人Mark Aubrey担任首席执行官
Unity技术手册 - 干扰/噪音/杂波(Noise)子模块
Uniapp converts graphic verification codes in the form of file streams into images
Golang open source streaming media audio and video network transmission service -lal
Navicat Premium 15 for Mac(数据库开发工具)中文版
User login 2
What exactly is a handler
Helsinki traffic safety improvement project deploys velodyne lidar Intelligent Infrastructure Solution