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

边栏推荐
- Swift responsive programming
- User registration, information writing to file
- 说下你对方法区演变过程和内部结构的理解
- Flutter assembly
- Educational administration system development (php+mysql)
- Interviewer: your resume says you are proficient in mysql, so you say cluster / Union / overlay index, table return, index push down
- Why does golang's modification of slice data affect the data of other slices?
- Navicat premium 15 for MAC (database development tool) Chinese version
- Understanding of reflection part
- Time wheel and implementation analysis of time wheel in go zero
猜你喜欢

Bypass technology to talk about 'cross end'
Take you to the open source project of smart home: the preliminary configuration of zhiting home cloud and home assistant+ homebridge

Interviewer: your resume says you are proficient in mysql, so you say cluster / Union / overlay index, table return, index push down

Learning notes of rxjs takeuntil operator

说下你对方法区演变过程和内部结构的理解

教务系统开发(PHP+MySQL)

心楼:华为运动健康的七年筑造之旅

赫尔辛基交通安全改善项目部署Velodyne Lidar智能基础设施解决方案

Detailed explanation of IVX low code platform series -- Overview (I)

Rxjs TakeUntil 操作符的学习笔记
随机推荐
Helsinki traffic safety improvement project deploys velodyne lidar Intelligent Infrastructure Solution
DOM event flow, event delegate
[untitled]
Don't underestimate the integral mall, its role can be great!
The paid video at station B caused the up master to lose more than ten thousand fans
Function and implementation of closures
[Third Party framework] retrofit2 (2) - add point configuration of network access framework
The textfield is encapsulated by the flutter itself, which causes the data display to be disordered when the data in the list is updated.
What can NFT metauniverse development do?
Reverse series to obtain any wechat applet code
Coredata data persistence
Mysql database multi table query
Go development team technical leader Russ Cox sends a document to share go's version control history
Alvaria宣布客户体验行业资深人士Jeff Cotten担任新首席执行官
一行代码可以做什么?
Nsurlsession learning notes (III) download task
Flutter textfield setting can input multiple lines
Don't underestimate the integral mall, its role can be great!
Activation and value transfer of activity
Converting cifar10 datasets