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 Getting Started with Java Strings and Variables

Mariya Shklyar
Mariya Shklyar
1,022 Points

I'm on a second lesson of Java basics Strings and Variables. I was trying to console, but it gives me a error.

error: reached end of file while parsing

I tried doing the same thing and didn't get any errors, are you sure you closed your parenthesis?

4 Answers

Mariya Shklyar
Mariya Shklyar
1,022 Points

https://teamtreehouse.com/workspaces/07ojppsulm/fork

console.printf("Hello, my name is Mariya"); console.printf ("Mariya is learning how to write Java");

My code is import java.io.Console;

public class MyConsole { public static void main(String[] args) { String firstName ="Alex"; Console console = System.console(); console.printf("%s can code in Java!", firstName);
} } But i got error is in eclipse Exception in thread "main" java.lang.NullPointerException at MyConsole.main(MyConsole.java:6) line 6 is printing line.

Mariya,

Make sure you save the code before compiling in the console.

Eric