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 Meet Objects Welcome Back

How do you add lager sums of number to Int

What if you are making a personality test that works like A+10 B + 20 C-10 D-20 At first I thought I could just do int x = 0; if (answer.equals("b")) { x + 20; }

however that did not work at all. Can someone help me please

1 Answer

Philip Schultz
Philip Schultz
11,437 Points

// you can't simply say x + 20; you could say x = x + 20 or short hand x += 20;

if(answer.equalsIgnoreCase("b")) { x += 20;
}