当前位置:网站首页>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

边栏推荐
- Flutter assembly
- XML usage and parsing of data storage and transmission files
- Nsurlsession learning notes (III) download task
- Linux-MySQL数据库之高级SQL 语句一
- Webgl and webgpu comparison [4] - uniform
- Div element
- 10 Super VIM plug-ins, I can't put them down
- Coredata data persistence
- Dino: Detr with improved detecting anchor boxes for end to end object detection
- In the wechat environment, H5 jumps to the specified page of the applet
猜你喜欢
Why does golang's modification of slice data affect the data of other slices?

The style of the mall can also change a lot. DIY can learn about it!

iVX低代码平台系列详解 -- 概述篇(一)

Preliminary understanding of JVM

深入理解和把握数字经济的基本特征

Learning notes of rxjs takeuntil operator
Golang open source streaming media audio and video network transmission service -lal

DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection翻译

The first day of reading mysql45

Lifeifei's team applied vit to the robot, increased the maximum speed of planning reasoning by 512 times, and also cued hekaiming's MAE
随机推荐
DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection翻译
The first day of reading mysql45
Common APIs and exception mechanisms
Linux-MySQL数据库之高级SQL 语句一
Xinlou: Huawei's seven-year building journey of sports health
Built in function globals() locals()
商城风格也可以很多变,DIY了解一下!
DOM event flow, event delegate
Function and implementation of closures
Coredata data persistence
Introduction to MgO 256gb NAND flash chip
[issue 24] one year experience of golang to develop futu
Swift responsive programming
数据存储和传输文件之XML使用和解析详解
Several ways of SQL optimization
Read mysql45 the next day
Go language - what is critical resource security?
cmd。。。。。。
File operation, serialization, recursive copy
Alvaria宣布客户体验行业资深人士Jeff Cotten担任新首席执行官