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

abdulkadir akti
abdulkadir akti
46 Points

how console work

i could not figure out how console work

Name.java
// I have setup a java.io.Console object for you named console
 String firstName= kadir;
system.printf("",firstName);

1 Answer

A Y
A Y
1,761 Points

abdulkadir,

1) import the library that allowed the console to work (((import java.io.Console;))) 2) declare an object of console to be used ((( Console console = System.console();))) 3) start use it (((console.printf or console.readLine)))

You have declared the (((String firstName= kadir;))) without the quotes (((String firstName= "kadir";))) and you have declared the (((system.printf("",firstName);))) with lower case S in system and without the specifier "%s" to point at the String like that (((System.printf("This is my name %s", firstName);

Please try: String firstName= "kadir"; System.printf("This is my name %s", firstName);

Regards, Amir