byteValue(): This method is available in java.lang.Number class of Java.
Syntax:
byte java.lang.Number.byteValue()
This method returns the value of the specified number as a byte. This implementation returns the result of int Value cast to a byte.
Parameters: NA
Returns: the numeric value represented by this object after conversion to type byte.
Exceptions: NA
For Example:
Number number = 1234
number.byteValue() = > It returns 1234.
Approach
Java
public class NumberbyteValue {public static void main(String[] args) {Number number = 1234;System.out.println(number.byteValue());}}
Output:
1234
No comments:
Post a Comment