Numerical values are primitive data type in java. Because its primitive data type so it will also extend these properties:
Helper classes are those who help data types. Java class library include numeric helper classes. Helper classes basically includes conversation and output tools. If we want to convert data type then we can use helper classes.
Data Type | Helper Class |
---|---|
byte | Byte |
short | Short |
int | Integer |
long | Long |
float | Float |
double | Double |
Double helper class provide tools to convert float value to double value. As shown below:
The default value of any numeric data type is 0. Ok let’s demonstrate that default value of any numeric data type is 0.
Here is example:
open notepad and write below
class NumericTest{public static void main(String[] args){int a;System.out.println("value of numeric is : "+a);}}
and save this file as “NumericTest.java”, now compile this and check output
And you can see, in output value is 0. (or you will get compile time error that variable not initialized)
Quick Links
Legal Stuff
Social Media