Source code for DoubleExample.java:

public class DoubleExample
{
	public static void main(String args[])
	{
		// DoubleExample
		double val1 = 7.0 / 9.0;
		double val2 = 2.0 / 9.0;
		double val3 = val1 + val2;
		System.out.println(val1);
		System.out.println(val2);
		System.out.println(val3);
	}
}

Output from DoubleExample.java:

0.7777777777777778 0.2222222222222222 1.0

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the DoubleExample application at the momement. You need to compile and run the source code first.

To run this program:


Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR