Results 1 to 4 of 4

Thread: User input from the console

Threaded View

  1. #1

    Thread Starter
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Resolved User input from the console

    How can i get user input from the console?

    Here is my code so far if it helps:
    Code:
    public class Student
    {
    	private static String Teacher;
    	private static String StudentName;
    
    	/**
    	 * Create a student
    	 *
    	 * @param StudentName
    	 */
    	public Student()
    	{
                //Do nothing!
    	}
    	
    	public static void main(String StudentName)
    	{
    	    Student student = new Student();
    	    	    
                Teacher = "Mr Whyley";
                StudentName = StudentName;
                //Print details
                System.out.println("Student Name: " + StudentName);
                System.out.println("Teacher: " + Teacher);
    	}
    
    	/**
    	 * Get teacher name for a student
    	 * 
    	 * @return Teacher
    	 */
    	public String getTeacher()
    	{
    	    return Teacher;
    	}
    }
    I want to get 'StudentName' from the console.
    Last edited by x-ice; Feb 25th, 2007 at 07:17 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width