Wrappers.emptyWrapper()
时间: 2023-12-07 19:06:13 浏览: 48
`Wrappers.emptyWrapper()` is a static method in the Java programming language that returns an empty wrapper object for a given primitive type. The wrapper classes in Java, such as `Integer`, `Float`, `Boolean`, etc., are used to wrap primitive data types so that they can be used as objects.
For example, if you want to create a new `Integer` object with the value `0`, you can use the following code:
```
Integer integerObj = new Integer(0);
```
However, if you just want an empty `Integer` object, you can use `Wrappers.emptyWrapper()` instead:
```
Integer emptyIntegerObj = Wrappers.emptyWrapper(Integer.class);
```
This will return an empty `Integer` object with the value `null`. The `emptyWrapper()` method takes a `Class` object as a parameter, representing the type of the wrapper object you want to create.
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)