Results 1 to 2 of 2
  1. #1
    mcollins is offline Member
    Join Date
    Mar 2009
    Rep Power

    Default Trying to workout how to input text


    I'm trying to simply modify some Hello World code, so that the user can input their name and it says "Hello <name>"...

    Below is what I've written so far...

    Java Code:
    class prog
    	public static void main(String name)
               System.out.println("Hello" + name);
    I'm using BlueJ and I have tried the 'Scanner' but for some reason it doesn't work with BlueJ

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Hello. No, you can't change the main method in that way. The program will compile, but since you've changed the "signature" of the main method, the JVM will not know how to start your program when you try to run it. You're far better off trying to use Scanner again. Scanner works fine with BlueJ as long as you've set it up to compile as a Java 1.5 or 1.6 program.

Similar Threads

  1. count character in text file as input file
    By aNNuur in forum New To Java
    Replies: 7
    Last Post: 03-25-2010, 04:01 PM
  2. Replies: 2
    Last Post: 01-23-2009, 04:09 PM
  3. find and replace text from a text file
    By gezzel in forum New To Java
    Replies: 2
    Last Post: 09-19-2008, 04:04 PM
  4. Replies: 0
    Last Post: 05-26-2008, 04:26 PM
  5. how to take input and verify input in Java programs
    By bilal_ali_java in forum Advanced Java
    Replies: 0
    Last Post: 07-21-2007, 08:46 AM

Posting Permissions

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