Java Java Basics Getting Started with Java Receiving Input

Chengetai Masalethulini
Chengetai Masalethulini
313 Points

I followed the steps for the "what is your name" prompt but when I press enter I keep getting "Hello my name is ...

Is it possible for me to restart the workspace from scratch? I think I may have missed a step

Tonnie Fanadez
Tonnie Fanadez
UX Design Techdegree Graduate 22,768 Points

Hello Chengetai Masalethulini please copy-paste your code here but before that please save your work and try to compile.

2 Answers

rydavim
MOD
rydavim
Treehouse Moderator 17,776 Points

Before starting over from scratch, remember you can always ask our helpful community to take a look at your code. But if you'd like to go back to the beginning...

This is the starting code for that video:

import java.io.Console;

public class Introductions {

    public static void main(String[] args) {
        Console console = System.console();
        // Welcome to the Introductions program!  Your code goes below here
        String firstName = "Ben";
        //thisIsAnExampleOfCamelCasing
        console.printf("Hello, my name is %s\n", firstName);
        console.printf("%s is learning how to write Java\n", firstName);
  }
}

You can also launch a fresh copy of any workspace template with the following steps:

  1. Click the Launch Workspace button at the bottom right of the video.
  2. Instead of clicking the green Launch it! button, click over to the grey link that says Launch Different Workspace.
  3. From this page, create a new workspace.
  4. From the last drop down, select the template you'd like to use. In this case, Getting Started with Java - Receiving Input.

Let me know if you have any questions, and happy coding!

Chengetai Masalethulini
Chengetai Masalethulini
313 Points

Great, managed to launch a fresh copy of the workspace and follow the steps again without encountering any of my previous challenges. Thank you for the advice!