Results 1 to 4 of 4
  1. #1
    wordmeup is offline Member
    Join Date
    Aug 2016
    Location
    California
    Posts
    2
    Rep Power
    0

    Default I am having an issue on a Java question TeamTreehouse. I am a noob...

    Using the console's printf method, display a message that says, "First name: ", followed by the first name that the user has entered.

    My Current CODE on TeamTreehouse:

    // I have imported java.io.Console for you. It is a variable called console.
    String firstName = console.readLine ("What is your name ?");
    String lastName = console.readLine ("What is your last name ?");
    console.printf =("First Name:%s", firstName);

    The errors I get:
    JavaTester.java:129: error: ')' expected
    console.printf =("First Name:%s", firstName);
    ^
    JavaTester.java:129: error: not a statement
    console.printf =("First Name:%s", firstName);
    ^
    JavaTester.java:129: error: ';' expected
    console.printf =("First Name:%s", firstName);
    ^
    3 errors

    I am lost, I look at my code and don't see it. :( I tried editing over and over... When I reference my Workspace I verify my previous use of console.printf and %s to call my string. Please advise! Thank you!

  2. #2
    wordmeup is offline Member
    Join Date
    Aug 2016
    Location
    California
    Posts
    2
    Rep Power
    0

    Default Re: I am having an issue on a Java question TeamTreehouse. I am a noob...

    I am having an issue on a Java question TeamTreehouse.  I am a noob...-screen-shot-2016-08-23-6.47.17-pm.png

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: I am having an issue on a Java question TeamTreehouse. I am a noob...

    Java Code:
      console.printf =("First Name:%s", firstName);
    With the = operator that looks like an assignment statement.
    If you are trying to call the printf method, remove the =
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: I am having an issue on a Java question TeamTreehouse. I am a noob...

    The Console may not be supported. I know it doesn't work directly in the Eclipse IDE.
    For output see System.out which uses PrintStream. For console type input, I recommend the
    Scanner class.

    EDIT: I just checked and Console does work using the Windows 10 cmd window as
    long as you run the jvm using java and not javaw. But my original recommendation stands.

    Regards,
    Jim
    Last edited by jim829; 08-24-2016 at 05:36 PM.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Replies: 16
    Last Post: 08-02-2013, 04:45 PM
  2. Noob Java Math Question...
    By tomtrom77 in forum New To Java
    Replies: 5
    Last Post: 01-31-2013, 02:40 PM
  3. noob issue
    By disturbe13 in forum New To Java
    Replies: 2
    Last Post: 11-02-2012, 08:26 PM
  4. Replies: 8
    Last Post: 06-30-2010, 02:30 AM
  5. Help im a noob.. a super noob on java..
    By critdevil in forum New To Java
    Replies: 12
    Last Post: 03-07-2009, 03:17 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •