[Java] Common classes (1) common method of java.lang.Number (abstract)




Foreword

  Number is an abstract class, the class is Numeric Byte, superclass Short, Integer, Long, Float, Double, BigInteger, BigDecimal is (there are several classes under java.util.concurrent.atomic package regardless of being the first).

  Number abstract class above in order to allow a few to inherit.


First, outline

Here Insert Picture Description

  • Parent class: java.lang.Object
  • Implement an interface: Serializable
public abstract class Number extends Object implements Serializable

Second, the common method

1. speaking with several methods

byteValue()、doubleValue()、floatValue() 、intValue() 、longValue() 、shortValue()

  • I understood that: Several methods above are just the same as it does not return a value, such as o byteValue () method returns a byte, doubleValue in () returns a double type, several other so on. Role Well, that is return to the basic data types, subclass inherits the time easy to use.
  • Returns: Returns the value of several basic data type representations

Related Links

Previous: [Java] common classes (0) java.lang.Object common method

Current articles: common method commonly used classes [Java] (1) java.lang.Number of (abstract)

Next: [Java] common classes (2) common method java.lang.Byte, Short, Integer, Long, Float, Double 's

Detailed Java wrapper classes: Java wrapper class Detailed

[Outline] Java classes used: [Java] common class syllabus

Published 86 original articles · won praise 104 · Views 6629

Guess you like

Origin blog.csdn.net/weixin_44034328/article/details/103797205