Define class and object

Define class and object. Explain them with an example using java.

Class: A class is a program construct which encapsulates data and operations on data. In object oriented programming, the class can be viewed as a blue print of an object.

Object: An object is a program construct that falls under a ‘classification’ (of a class) which has state and behaviour.

Example: Employee is an example of a class

A specific employee with unique identification is an example of an object.
class Employee
{
   // instance variables declaration
   // Methods definition
}

One of the objects of Employee is referred by ‘vismay’.
Explain class vs. instance with example using java
Explain class vs. instance with example using java - A class is a program construct which encapsulates data and operations on data......
What is a method?
What is a method? - A java method is a set of statements to perform a task. A method is placed in a class.Signatures of methods...
Difference between instance variable and a class variable
Difference between instance variable and a class variable - An instance variable is a variable which has one copy per object / instance. That means every object....
Post your comment