this the my first assignment given by my lecturer.
i've tried to do it and manage to compile..but the problem is i got confused on how this program execute?
is it line by line like c++?
can someone show me the sequence on how my program being executed and maybe doing some correction on it??

The question is in the attachment file.

//TESTSTUDENT
import javax.swing.JOptionPane;
public class TestStudent {
    public static void main(String[] args) {


    String firstName,lastName;
    Student s = new Student();
    Student t = new Student();


    firstName= JOptionPane.showInputDialog("Enter first name:"); 

    lastName= JOptionPane.showInputDialog("Enter last name:"); 

    s.setfirstName(firstName);

    t.setfirstName(lastName);

    JOptionPane.showMessageDialog(null, "Student Name is: "+s.getName() + " "+t.getName());        

    firstName= JOptionPane.showInputDialog("Enter first name:");

    s.setfirstName(firstName);

    JOptionPane.showMessageDialog(null, "Student Name is: "+s.getName()+ " " +t.getName());  

     } 

 }    


//STUDENT

public class Student{


    private String firstName;
    private String lastName;
    private String studentID;//attribute

    //constructor
    public void setStudent (String firstName,String lastName,String Student){    
    }

    //method
    public String getName(){
        return firstName;

    }
    public void setfirstName(String newfirstName){
        firstName=newfirstName;
        }
}

what do you think will happen?
Have you even tried it?

And no, we're not going to read your assignment that you attached as a word document.

If something doesn't work as you think it should, tell us what it does, what it should do, and we may be able to tell you where you made a mistake.

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.