All pastes #612920 Raw Edit

Something

public java v1 · immutable
·published 2007-07-10 18:18 UTC
rendered paste body
class OOPPractice{	public static void main(String args[])	{		System.out.println("Hello World!!");		Calc int1 = new Calc();		Calc int2 = new Calc();		int1.assign(30);		int2.assign(5);		System.out.println(int1.value + " + " + int2.value + " = " + int1.add(int2.value) + "\n");		System.out.println(int1.value + " - " + int2.value + " = " + int1.subtract(int2.value) + "\n");		System.out.println(int1.value + " * " + int2.value + " = " + int1.multiply(int2.value) + "\n");		System.out.println(int1.value + " / " + int2.value + " = " + int1.divide(int2.value) + "\n");	}}class Calc{	int value = 0;	void assign(int number)	{		value = number;	}	int subtract(int x)	{		// value = value - x;		return value - x;   // This way, the new value is not stored, just returned.	}	int multiply(int x)	{		value = value * x;		return value;	}	int divide(int x)	{		value = value / x;		return value;	}}