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

Zandre Alberts
Zandre Alberts
2,613 Points

They tell me error: cannot find symbol

They say this: JavaTester.java:116: error: cannot find symbol String Name = readLine("Enter your name: "); ^ symbol: method readLine(String) location: class JavaTester And here is the code: String Name = readLine("Enter your name: ");

2 Answers

Rob Bridges
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 Points

Hi Zandre, I believe this is the challenge where you're supposed to enter your name. In that case readLine is a method that is on the predefined console object.

So it should be

String name = console.readLine("Enter your name: ");
Simon Coates
Simon Coates
28,694 Points

I think this means that the method readline doesn't exist in the current code context. Is readline meant to be called on an object? (if this is in reference to a code challenge or a workspace, more detail about the problem would help)