Java Java Basics Getting Started with Java Strings and Variables

3 Answers

Micah Hack
Micah Hack
10,914 Points

By quickly looking at the snapshot I can see that you had a typo for "firstName". Your code: String firtsName = "dan"; I'm always making mistakes like this especially when it comes to the camel casing.. Using an IDE sure has helped big time, lol.

daniel horan
PRO
daniel horan
Pro Student 1,441 Points

thanks for reply i actually noticed that after i sent this question and i fixed it but it still doesn't work. any other ideas as to why?

Micah Hack
Micah Hack
10,914 Points

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 = console.readLine("What is your name?  ");
  //thisIsAnExampleOfCamelCasing
  console.printf("Hello, my name is %s\n", firstName);
  console.printf("%s is learning to write Java\n", firstName);        

} }

Here is my code for reference. Are you sure that you are entering the correct commands in the console when you attempt to compile and run the code? First command should be: javac Introductions.java to compile the code and then: java Introductions to run it. Hope this helps! I have a habit of always entering "clear && javac Examplefile.java && java Examplefile" in the console to clear the console, compile, and run all in one go.