Java Java Basics Getting Started with Java Strings, Variables, and Formatting

Ayleen Nazario
Ayleen Nazario
1,082 Points

Define string variable firstName

Hi there,

Context: This is my first exercise. I have no coding experience and am running into my first problem.

Question: Attached you'll see the code I wrote for this exercise which asks me to define a string that asks me for firstName. Was there a certain set of lines I was supposed to write before writing out the string? Where can I look to find out how to set my code up for success starting from the very first line?

Thanks! Ayleen
// I have setup a object for you named console

  String firstName = "Ayleen";

  console.printf("Hi, my name is %s.\n", firstName);


1 Answer

Trent Christofferson
Trent Christofferson
14,920 Points

A way you can set your code up for success is always plan your project out. Planning reduces the amount of errors you may encounter from coding off the cuff. Once you plan out your project it is really easy to code because you have instructions to follow. It may not seem easy now to code some things, but it will. If you ever need help or don't understand something a good place to figure it out is the javadocs:

If you are wondering why it isn't passing you don't need to surround your code with {}, at least not in this quiz. Also you need the message to say "<YOUR NAME> can code in Java!"