Question: Object Instantiation using the Student Class Given the following Student Class declaration: Instantiate a Student Object using the already declared and initialized variables inputFirstName, inputLastName

Object Instantiation using the Student Class
Given the following Student Class declaration:
Instantiate a Student Object using the already declared and initialized variables inputFirstName, inputLastName and inputStudentID using the Student() constructor.
Call the already created describe() method on your Student object.
import java.util.Scanner;
public class CodingQuestion {
public static class Student {
private String firstName;
private String lastName;
private int studentID;
public Student(String firstName, String lastName, int studentID){
this.firstName = firstName;
this.lastName = lastName;
this.studentID = studentID;
}
public void describe(){
System.out.println("First Name: "+ this.firstName +", Last Name: "+ this.lastName +", Student ID: "+ this.studentID);
}
}// end of Student class
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String inputFirstName = in.nextLine();
String inputLastName = in.nextLine();
int inputStudentID = in.nextInt();
/* ADD your code below this line */
/* ADD your code above this line */
in.close();
}// end of main()
}// end of CodingQuestion class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!