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

Muhammad Asif
PLUS
Muhammad Asif
Courses Plus Student 557 Points

Call the printf method on the console object and make it write out "<YOUR NAME> can code in Java!"

i don't get understand the question if some one plz explain it and give me solution

Name.java
//import java.io.Console;
//public class Name {
 // public static void main (String [] args ){
   // Console console = System.console();
    String firstName = "Asif";
    console.printf("Hello, My name is %s\n",firstName);
    console.printf("%s\n  is learning java",firstName);
  //}
//}

2 Answers

Abua KC
Abua KC
5,932 Points

// print your firstName to the console.

console.printf("%s\n can code in Java!", firstName);

/* %s represents a string which happens to be your firstname. Anytime you see %s, it means your name has just been called. Thats why we made a reference to it at the end, so the console.printf knows that the string that was just called is firstName. if you have another string lastName , we will do the same thing, but make a reference to last name . I hope this this helps .

console.printf("%s\n can code in Java!", lastName);

*/

Abua KC
Abua KC
5,932 Points

you are welcome