FileDocCategorySizeDatePackage
NumberSums.javaAPI DocExample925Thu Sep 14 17:29:22 BST 2000None

NumberSums

public class NumberSums extends Applet

Fields Summary
private int
firstNumber
private int
secondNumber
private int
sumOfNumbers
Constructors Summary
Methods Summary
public voidpaint(java.awt.Graphics g)

		firstNumber = 21;		// assign the value 21 to firstNumber
		secondNumber = 32;	// assign the value 32 to secondNumber
									// now add firstNumber and secondNumber together
									// and save the result in sumOfNumbers
		sumOfNumbers = firstNumber  +  secondNumber;
									// use the string concatenator '+' to include
									// the value held in sumOfNumbers in the string
									// that gets printed.
		g.drawString("The sum of the numbers is " + sumOfNumbers, 20, 20);