class TernaryIsEquivalentToIfElseDemoWithConstructor
{
	public static void main(String[] args)
	{
		System.out.println("call the IfElseVersion constructor");
		new IfElseVersion();
		System.out.println("\ncall the TernaryVersion constructor");
		new TernaryVersion();
	}
}

class IfElseVersion
{
	IfElseVersion()
	{
		int x = 1;
		int y = 3;
		int lowestValue;
		for(int i = 0; i < 5; i++)
		{
			System.out.println("i is now: " + i);
			if(x < y) lowestValue = x;
			else lowestValue = y;
			System.out.println("\tx is " + x + " and y is " + y + " so lowestValue is " + lowestValue);
			x++;
		}
	}
}
class TernaryVersion
{
	TernaryVersion()
	{
		int x = 1;
		int y = 3;
		int lowestValue;
		for(int i = 0; i < 5; i++)
		{
			System.out.println("i is now: " + i);
			lowestValue = x < y ? x : y;
			System.out.println("\tx is " + x + " and y is " + y + " so lowestValue is " + lowestValue);
			x++;
		}
	}
}


