Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Main {
- public static void main(String[] args) {
- double f1 = .0;
- for (int i = 1; i <= 11; i++) {
- f1 += 0.1;
- }
- System.out.println(f1);
- String numFormatted = String.format("%.2f", f1);
- System.out.println(numFormatted);
- f1 = Double.parseDouble(numFormatted);
- System.out.println(f1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement