Last active
August 31, 2021 12:12
-
-
Save minte9/6548f90f1f4e2362be3c475ec15810b0 to your computer and use it in GitHub Desktop.
Java / Basics / Numbers - https://www.minte9.com/java/basics-numbers-1218
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Declare Number no as float 22.23 ... | |
* Use object's shortValue() method and ... | |
* Display no as 22 | |
*/ | |
class App { | |
public static void main(String[] args) { | |
/** | |
* SOLUTION | |
*/ | |
Number no = new Float(22.23); | |
System.out.println(no.shortValue()); // 22 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment