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 trialKyle Whitmore
4,999 PointsFor the following objective...
Can someone explain to me why the following code returns a value of 2 instead of one?
public int getLineNumberFor(String lastName) { int lineNumber = 0; int first = 1; int second = 2; String line1 = "abcdefghijklm"; char letter = lastName.charAt(0); boolean half = line1.indexOf(letter) != -1; if (half) { lineNumber = first; } else { lineNumber = second; } return lineNumber } }
1 Answer
Trent Christofferson
18,846 PointsYou can use the > and < sign on characters, which is what the task want you to do.