To declare a class in Java use:
public class NameOfClass {
// fields
// constructors
// methods
}
public class NameOfClass
{
// fields
// constructors
// methods
}
public class Person
{
// fields
private String firstName;
private String lastName;
// constructors
public Person () {}
public Person(String theFirstName, String theLastName)
{
this.firstName = theFirstName;
this.lastName = theLastName;
}
// methods
public String getFirstName() { return this.firstName; }
public String getLastName() { return this.lastName; }
public void setFirstName(String name) { this.firstName = name; }
public void setLastName(String name) { this.lastName == name; }
public String toString() { return this.firstName + " " + this.lastName; }
}