Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * An example to show that while floats can represent
- * decimal numbers and large numbers, floats only
- * have 6-7 digits of precision.
- *
- * Friday, January 14
- */
- package example03;
- /**
- * @author pajensen
- *
- */
- public class NumberExperiment
- {
- /**
- * @param args
- */
- public static void main (String[] args)
- {
- int x = 0;
- float y = 0; // Try changing this to 'double' instead of float
- while (x == y)
- {
- x = x + 1;
- y = y + 1;
- }
- System.out.println ("X = " + x);
- System.out.println ("Y = " + y);
- }
- }
Add Comment
Please, Sign In to add comment