Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects (Retired) Meet Objects Refresher

Nathan Good
Nathan Good
726 Points

Help me compare the weights below. I would like to see if Monty the office Great Dane weighs more than me.

int weightCraig = 160;
int weightMonty = 130;
if (weightMonty ___________ weightCraig) {
    console.printf("Whoa that's a huge dog!");
}

4 Answers

Norbu Wangdi
Norbu Wangdi
7,187 Points

int weightCraig = 160; int weightMonty = 130; if (weightMonty >weightCraig) { console.printf("Whoa that's a huge dog!"); }

I could not pass untill i used ">". its supposed to be "<"?

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

You can use the > operator

int weightCraig = 160;
int weightMonty = 130;
if (weightMonty ____>_______ weightCraig) {
    console.printf("Whoa that's a huge dog!");
}

In your code, nothin will happen, cause Monty isnt heavier then Craig :)

int weightCraig = 160;
int weightMonty = 130;
if (weightMonty ____<_______ weightCraig) {
    console.printf("Whoa that's a huge dog!");
}

Then you will see

"Whoa that's a huge dog!"

int weightCraig = 160; int weightMonty = 130; if (weightMonty 130<160_ weightCraig) { console.printf("Whoa that's a huge dog!"); }

Neil Kamath
Neil Kamath
2,078 Points

Does anyone know what tv series this is referencing ("The Office?")?