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
Leen Leenaerts
1,096 PointsminT cannot be resolved
I was solving this problem:
Given two temperatures, return true if one is less than 0 and the other is greater than 100.
icyHot(120, -1) → true icyHot(-1, 120) → true icyHot(2, 120) → false
public boolean icyHot(int temp1, int temp2) { if (temp1 < temp2) { int minT = temp1; int maxT = temp2; } else { int minT = temp2; int maxT = temp1; }
return (minT < 0 && maxT > 100); }
I'm getting the error:
Error: return (minT < 0 && maxT > 100); ^^^^ minT cannot be resolved
1 Answer
Ryan Ruscett
23,309 PointsHey,
For code, wrap it in backticks. It's the button just below the escape button Do three ``` and then at the end use three more. Or there is a link at the bottom of this window, called "Markdown Cheatsheet". Click it the next time you are typing in a window and you will see it. It has all the info.
You had way to much code before. You are taking in two integers and checking to see if one is less than 0 and the other is greater than 100. Then return true of false. I think you over thought it.
The temperature values you don't need to think about. Those are passed in behind the scenes. So basically in order to be true, temp1 must be less than 0 AND temp2 must be greater than 100. So we can do it all on one line and return true or return false.
public boolean icyHot(int temp1, int temp2) {
if (temp1 < 0 && temp2 > 100) {
return true;
} else {
return false;
See if that works for ya!
Leen Leenaerts
1,096 PointsLeen Leenaerts
1,096 Points2nd Q : how to insert code as code ? :) to make it more clear