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

Jacob Tran
Jacob Tran
844 Points

help me pls

what do i do next?

Name.java
String firstName = "jacob"; 
console.printf(firstName "jacob" ); 

2 Answers

Hey Jacob,

First, as you've done, you need to define a variable named firstName and assign it the value of your first name. The second part requires a call of the printf method. However, you don't want to just pass in the String of jacob. Instead, you'll want to pass in the firstName variable using the String formatter.

Like so:

String firstName = "jacob"; 
console.printf("%s can code in Java!", firstName); 

The final outputted sentence should be: jacob can code in Java!

Jacob Tran
Jacob Tran
844 Points

Jacob Proffer How come we used printf instead of println or print like other IDE? and how come we use console. instead of system.out.?

do I always need to put " " around a variable? I remember using other IDE, it doesn't require String firstName = "__" but just a value instead.