Java Double longValue() MethodThe longValue() method of Java Double class returns the value of this object as a long after narrowing the primitive values or by casting to type long. SyntaxParametersNA Return valueThe longValue() method returns the double value corresponding to this Double which has been converted to type long. Example 1Test it NowOutput: 1. Long value for 655.0 = 655 2. Long value for 6.575876985679675E12 = 6575876985679 3. Long value for -8.677698567988675E10 = -86776985679 Example 2Test it NowOutput: Enter three numbers 1.56.7568 2.422.087775 3.0.456454 1.Sum: 56+422+0 = 478 1.Mul: 56*422*0 = 0 Example 3Test it NowOutput: Enter your annual income 486674.4553 You got an increment of 5000. Your new monthly salary is:45556
Next TopicJava Double
|