View Single Post
  #2 (permalink)  
Old 08-06-2007, 10:48 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
Code:
import java.text.NumberFormat; import java.util.Scanner; public class Test { public static void main(String[] args) { NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(2); //nf.setMinimumFractionDigits(2); System.out.println(nf.format(3.1111111111222)); Scanner scanner = new Scanner(System.in); String response; do { System.out.println("Continue? \"y\""); response = scanner.nextLine(); } while(response.equals("y")); }
Reply With Quote