All pastes #930455 Raw Edit

Someone

public text v1 · immutable
·published 2008-03-06 16:42 UTC
rendered paste body
class Alien
{
	public Alien()
	{
		hp = 100;
	}
	
	public int getHp()
	{
		return hp;
	}
	
	public void hit()
	{
		hp -= 10;
	}
	
	int hp;
}

class alien
{

	public static void main(String args[])
	{
		Alien alien = new Alien();
		while ( alien.getHp() > 0 )
		{
			shoot(alien);
			System.out.println("Alien has " + alien.getHp() + " hp left.");
		}
	}

	static void shoot(Alien alien)
	{
		alien.hit();
	}
}