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, Variables, and Formatting

Chris Cherenegar
Chris Cherenegar
321 Points

why is my error pointing at public class?

The notes indicate the object was already created, but I'm still getting an error. What am I doing wrong.

Name.java
// I have setup a java.io.Console object for you named console

public class Name {

 public static void main(Strings [] args)
  {
  String Name = "Shazdeh";
  system.Console("My name is %s\n", Name);
  }
}

2 Answers

It good that you had the idea to use classes, however, here you're just required to declare a variable. No classes, no main functions, nothing. Just a simple line. Make sure you follow the conventions for camelCasing // don't start a variable with an upper case.

One more thing, when using a console object, use only console.printf, rather than system.Console

Harry James
Harry James
14,780 Points

Marking this as the Best Answer as asker has confirmed it has fixed the issue :)

Chris Cherenegar
Chris Cherenegar
321 Points

great thank you! I make things far too difficult