October 10th

What is wrong with the following code?  How can you fix it?

int pizzas = 4;
int hungryPeople = 8;
System.out.println("Each person gets " + pizzas/hungryPeople + " pizzas.");

Hint:  what is the output of the print statement?  What should it be?

 

Leave a Reply

Your email address will not be published. Required fields are marked *