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 trialchris diaz
1,732 PointsCall the printf method on the console object and make it write out "<YOUR NAME> can code in Java!" I do not understand
I have not been able to grasp they way it should be written in the console. for example do I need to type public class console and public void main to use printf?
// I have setup a java.io.Console object for you named console
public class console{
plubic static main (string [] args)
Console console=system.console();
String firstName = "Chris" ;
Console. printf("%s",firstName);
}
3 Answers
Vedang Patel
7,114 PointsHi Chris
You've done many mistakes let me point them out
you don't have to write the first 3 lines and the last line.
You shouldn't keep a space between console. and printf
after %s you should type "can code in Java!"
If you can't find it out go below
copy it if you like!
SPOILER ALERT
String firstName = "Vedang" ;
console.printf("%s can code in Java!", firstName);
chris diaz
1,732 PointsNope that did not work Vedang Patel
String firstName="Chris"; Console.printf("%s can code in Java!", firstName);
and resulted in
JavaTester.java:74: error: cannot find symbol Console.printf("%s can code in Java!", firstName); ^ symbol: variable Console location: class JavaTester Note: JavaTester.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error
Vedang Patel
7,114 Pointsyour Console has a capital C, it should Lower Case. As you have to remember Java is a case sensitive language
chris diaz
1,732 Pointsthanks for the help