Professional Documents
Culture Documents
Green University of Bangladesh: Department of Computer Science and Engineering Assignment
Green University of Bangladesh: Department of Computer Science and Engineering Assignment
Green University of Bangladesh: Department of Computer Science and Engineering Assignment
assignment
Object: An OBJECT is an instance of a class. Classes are categories, and objects are items within each
category like variables, methods.
Method: A method is a block of code or collection of statements or a set of code grouped together
to perform a certain task or operation. It is used to achieve the reusability of code. We write a
method once and use it many times.
Program:
public class Main {
obj1.displayMethod();
obj2.displayMethod();
obj3.displayMethod();
}
class Teacher {
Teacher() {
name = n;
id = i;
salary = s;
Teacher(Teacher obj1) {
void displayMethod() {