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 Basics Perfecting the Prototype String Equality

Pratham Patel
Pratham Patel
4,976 Points

I need help with a java basics code challenge

I keep getting a compiler error saying cannot find symbol

Equality.java
// I have imported a java.io.Console for you, it is named console. 
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";  
if (firstExample.equals(secondExample));
{
  console.printf("first is equal to second");
}
if (firstExample.equalsIgnoringCase(thirdExample));
{
  console.printf("first and third are the same ignoring case");
}

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Rakesh,

You've almost got it. It's just a naming error for the method. The method is named with ignore not ignoring. So, what you need is,

if (firstExample.equalsIgnoreCase(thirdExample));

Other than that... good job and keep coding! :)

:dizzy:

Simon Coates
Simon Coates
28,694 Points

It's trying to tell you it doesn't recognize the method. The method should be equalsIgnoreCase. It's worth remembering that particular message, since it seems to show up a lot during the java challenges (no autocomplete or error highlighting to catch trivial errors). If in doubt about a standard java method, consult the online API.