this is what I have now. I only know how to manually put them into the program. How do you read in the names?

import cs1.Keyboard;

public class TestName
{
   public static void main (String[] args)
    {

        //construct two new objects
        Name Name1 = new Name("Mike", "Matt", "Jones");
        Name Name2 = new Name("Tommy", "Lee", "Smith");

        //information for Name1
        System.out.println(Name1.firstMiddleLast());
        System.out.println();
        System.out.println(Name1.lastFirstMiddle());
        System.out.println();
        System.out.println(Name1.initials());
        System.out.println();
        System.out.println("Name Length: " + Name1.length());
        System.out.println();

        //information for Name2
        System.out.println(Name2.firstMiddleLast());
        System.out.println();
        System.out.println(Name2.lastFirstMiddle());
        System.out.println();
        System.out.println(Name2.initials());
        System.out.println();
        System.out.println("Name Length: " + Name2.length());
        System.out.println();

        //see if the names are equal
        if (Name1.equals(Name2))
            System.out.println("The names are the same.");
        else
            System.out.println("The names are not the same.");
        System.out.println();
    }
}

I think this is what you want.

import java.io.*;

public class ReadLine
{
    public static void main(String[] args)
    {
        try
        {
            InputStreamReader reader = new InputStreamReader(System.in);
            BufferedReader in = new BufferedReader(reader);
            System.out.print("enter text>>>");
            String str = in.readLine();
            System.out.println(str);
        }
        catch (IOException e) {}
    }
}

or, using Swing:

import javax.Swing.JOptionPane;

public class ReadAName{

       public static void main(String args[]){
               String name = JOptionPane.showInputDialog(null, "Give a name.";
                System.out.println("Name : " + name);
        }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.