Thread: Beginner Help (Java code)

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    1

    Beginner Help (Java code)

    Code:
    import java.util.Scanner;
    
    public class EnteredNames
    {  
       public static void main(String[] args)
       {  
          Scanner in = new Scanner(System.in);
    
          System.out.println("Enter Name1:     ");
          System.out.println("Enter Name2:   ");
          System.out.println("Enter Name3:     ");
          System.out.println("Enter Name4:   ");
          System.out.println("Enter Name5:     ");
         
       }

    I'm really new to programming and have been struggling with this forever. I'm supposed to have a user enter five names and then have those names printed out and stored in an array. This is what I have so far. If I could get just a heads start it would be greatly appreciated, I'm not asking for the entire project to be done, I just have no idea where to go from here.
    Thanks.

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    I have use what this link says in the past

    But this is a C/C++/C# forum, not a JAVA one

  3. #3
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    964
    Well you have your scanner lined up and ready, you just need to tell it to wait for input. I suggest looking into nextLine().
    How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting Java code into C, I need help >.<
    By minidragon in forum C Programming
    Replies: 3
    Last Post: 05-26-2011, 04:30 AM
  2. How to call java code from c++ program
    By Sam200723 in forum C++ Programming
    Replies: 3
    Last Post: 01-23-2007, 07:49 PM
  3. Java to C++ Code Converter
    By byte in forum C++ Programming
    Replies: 11
    Last Post: 10-02-2005, 09:04 PM
  4. Comparing Pascal, C, C++ and Java thru Code.
    By jozzua in forum C++ Programming
    Replies: 14
    Last Post: 07-07-2004, 12:03 AM
  5. Double check on Java code.
    By sean in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 07-05-2002, 09:55 AM