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

What is wrong with this code?

For some reason the compiler gives me a error but when I excute this code in workspaces everything is okay.

// I have imported a java.io.Console for you, it is named console. 
String firstExample = "hello";
String secondExample = "hello";
String thirdExample = "HELLO";
if (firstExample.equalsIgnoreCase(secondExample)) {
  console.printf("first is equal to second");'
JavaTester.java:123: error: illegal start of expression
  private static void pass() {
  ^
JavaTester.java:123: error: illegal start of expression
  private static void pass() {
          ^
JavaTester.java:123: error: ';' expected
  private static void pass() {
                ^
JavaTester.java:123: error: ';' expected
  private static void pass() {
                            ^
JavaTester.java:127: error: illegal start of expression
  private static void fail(String hint) {
  ^
JavaTester.java:127: error: illegal start of expression
  private static void fail(String hint) {
          ^
JavaTester.java:127: error: ';' expected
  private static void fail(String hint) {
                ^
JavaTester.java:127: error: ')' expected
  private static void fail(String hint) {
                                 ^
JavaTester.java:127: error: illegal start of expression
  private static void fail(String hint) {
                                      ^
JavaTester.java:127: error: ';' expected
  private static void fail(String hint) {
                                       ^
10 errors

1 Answer

I would check your brackets. Also posting your full code would really help so we can see what you are looking at.