1. Relevant knowledge points of data type
1.1. Conversion of Java built-in encapsulation class
The encapsulated classes built into Java, Byte, Integer, Float, double, and long can all be converted to numeric values of type double, because there are doublevalue () methods in these packaged classes. In turn, this method can be converted into a numeric value of type Double, "The reference object of each class declaration will have the corresponding Xxxvalue () method, converted to the data type you want "
Like what:
Package Fdx.test.shujukind;public class Testone {public static void main (string[] args) {byte b = new Byte ("12"); System.out.println ("b=" +b+ " byte converted to double type:" +b.doublevalue ()); float f = new float ("123"); System.out.println ("f=" +f+ " float converted to Double type:" +f.doublevalue ());D ouble d = new Double ("324"); System.out.println ("d=" +d+ " double converts to double type:" +d.doublevalue ());}}
The results obtained:
B=12 byte to double type: 12.0f=123.0 float to double type : 123.0d=324.0 double convert to double type: 324.0
Like what:
At the same time: All encapsulation classes (byte, short, Integer, Float, Double, Long) provide a static valueof (string s) method that converts the value of a given String type to the data type (byte, short , Integer, Float, Double, Long)
Like what:
1.2
Small knowledge points in Java