Created
December 5, 2015 19:04
-
-
Save Yur-ok/2ae608cb9b410e42e2c9 to your computer and use it in GitHub Desktop.
25.6 => 25 и 6
This file contains hidden or 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
package Lesson1_frame5; | |
/** | |
* Created by Юрий on 06.12.2015. | |
*/ | |
public class DoubleValue { | |
public static void main(String[] args) { | |
double value = 25.6; | |
String val = String.valueOf(value); | |
System.out.println(val.substring(0,2)); | |
System.out.println(val.charAt(3)); | |
} | |
} |
Да, теперь я понял ошибку. А именно то, что мой код не универсален.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Если задать, например, такое значение 1.12345, то Ваша программа выдаст не правильный результат.