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 trialroshaan zafar
3,868 Pointswhat could be the problem
rectify me please
String firstName="roshaan";
console.printf("roshaan");
4 Answers
Daniel Szepanski
Courses Plus Student 5,098 PointsHi, try to declare your console like ->
Console cons = System.console();
String firstName = "roshaan";
cons.printf("Hallo %s", firstName); // <--don't forget to use your variable
or as Aymen Hachicha said use System.out.printf("Hallo %s", firstName);
Hope i could help you.
Aymen Hachicha
12,653 PointsIt's System.out.printf(); not console.printf :)
Matthias Nörr
8,614 PointsString firstName = "roshaan";
System.out.print(firstName);
The problem is still there. In the first line you create a new variable called firstName and store "roshaan" inside. If you want to print out the String-Variable you have to insert the name of the variable into the print-command.
Aymen Hachicha
12,653 Pointsprintf or println not print ..
Matthias Nörr
8,614 PointsSystem.out.print does also compile. It just does not look pretty.