jimdandy75's Profile User Rating: -----

Reputation: 37 Craftsman
Group:
Active Members
Active Posts:
311 (0.14 per day)
Joined:
30-June 08
Profile Views:
13,337
Last Active:
User is offline Mar 16 2014 07:28 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   jimdandy75 I <3 Zombies !!!!

Posts I've Made

  1. In Topic: A Debugging Exercise That Prints Out The User's Name

    Posted 16 Mar 2014

    The String variables in the method whatName() are local variables, so they have null value because you haven't assigned them any other value. String is an Object so it's default value is null. I don't believe you can return a null value, so that is where the error is coming from?. The name variable in the main method will have the value the user enters. To pass that to another method, give it an argument.

        public static void main(String[] args) {
          Scanner input = new Scanner(System.in);
          String name;
          System.out.print("Enter name here: ");
          name = input.nextLine();  
          System.out.println("Hello, " + name + "!");
        }
    
    

My Information

Member Title:
D.I.C Regular
Age:
39 years old
Birthday:
January 26, 1975
Gender:
Location:
Indiana
Interests:
Spending time with my family, Colts football, , and becoming a better programmer.
Years Programming:
3
Programming Languages:
Java, C#, some C++, JavaScript, HTML, CSS

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Comments

jimdandy75 has no profile comments yet. Why not say hello?