Welcome to the Treehouse Community
Looking to learn something new?
I do not understand
the first challenge in beginning java task 2 I do not understand
// I have setup a java.io.Console object for you named console String firstName = "weston";
Antonio De Rose20,882 Points
give a try, go through the video over and over, and then try it out, if you make an effort, we can help find out what is missing / lacking
Dane ParchmentTreehouse Moderator 10,991 Points
I recommend that you go back and re-watch the video, probably taking notes, since you aren't retaining the information after videos.
The challenge is asking you to use the
printf() method to display a formatted text with the value of
<Your Name> can code in Java!. So we will use the printf syntax to do that. You should be used to using print statements by now so I won't go over what the syntax for it should look like, instead I will go over the specifics needed to solve this.
Step 1: The print statement!
// Challenge 1 String firstName = "weston"; // Challenge 2 System.out.printf("<Your Name> can code in Java!");
This is the next challenge part below!
Step 3: Replacing
<Your Name> with the variable for your name. That's it we are done!
// Challenge 1 String firstName = "weston"; // Challenge 2 & 3 System.out.printf("%s can code in Java!", firstName);
printf uses a tag-based formatting system to display variables or format text. Here we are using the tag
%s to designate that we are expecting type of String to be there. We then provide the variable for that tag at the end of the print statement after the comma. Again if this is confusing please re-watch the videos covering PrintF statements and take notes.