Loading video...
QuickNotes™ 
Classes and Objects
Class: A class is a software package or template that describes the characteristics of similar objects.
A class consists of variables describing an entity and methods to operate on the variables.
class Person {
private String first = "", last ="", MI ="" ,ID="";
private long id = 0;
public void setName(String fName, String lName, String mi){
first = fName ;
last = lName ;
MI = mi ;
}
public void setID(String Id){
id = Id ;
}
public String getName() {
return (last + ","+first + " " + MI);
}
public String toString(){
String st = getName() + "
ID : " + ID + "
Birth Date : "+ bDay ;
return st ;
}
} // end of class person definition
Object: Is an instance of a class, which is created at the run time.
Person p1; // object p1 of type person
Discussion 
Please login to ask a question and view discussion.













