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 trialHarsh Jindal
636 PointsI am unable to run this how to run this.
Help me to solve this.
// I have setup a java.io.Console object for you named co
class Introductions{
public static void main(String []args){
firstName = "Harsh";
Console console = System.console();
console.printf("Harsh");}
}
3 Answers
Darwin Palma
3,430 PointsHi, Harsh Jindal verify that you must declare the String variable firstName and the imports for Console.
Juraj Sallai
7,188 PointsHi Harsh,
Challenge is asking you to print this in following format:
"<YOUR NAME> can code in Java!"
Also, you do not have to declare class, main method or Console. All this is done for you in this challenge.
Timmie Nilsson
4,463 PointsYou must declare that firstName is a String then you must add the String to the printf with more text to it. Then with readline you enter a string(yourname) for exempel.
// I have setup a java.io.Console object for you named co
class Introductions{
public static void main(String []args){
Console console = System.console();
String firstName = console.readLine("Enter your name: ");
console.printf("%s can code in Java!", firstName);}
}