Question: Hello, Please help, I keep getting an error when I compile this in jGrasp. It says I'm not using private String fristname; correctly. import java.io.*;
Hello,
Please help, I keep getting an error when I compile this in jGrasp. It says I'm not using "private String fristname;" correctly.
import java.io.*;
import java.util.*;
public class Student
{
public static void main(String[] args) {
private String firstname;
private String lastname;
private double GPA;
private int id;
public Student(String firstname, String lastname, double gPA, int id)
{
super();
this.firstname = firstname;
this.lastname = lastname;
GPA = gPA;
this.id = id;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getlastname() {
return lastname;
}
public double getGPA() {
return GPA;
}
public void setGPA(double gPA) {
GPA = gPA;
}
public int getID() {
return id;
}
public void setID(int id) {
this.id = id;
}
public String toString()
{
return "Student [firstname=" + firstname + ", lastname=" + lastname
+ ", GPA=" + GPA + ", id=" + id + "]";
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
