Class
In object-oriented programming (OOP), a class is a template that defines the structure and behavior of objects. A class is a logical entity that encapsulates its attributes (data members) and methods (functions).
Class sample code
package in.ihelpyou; public class Calc { public int a, b; public int addition() { return a + b; } public int subtraction() { return a - b; } public static void main(String[] args) { Calc obj = new Calc(); obj.a = 10; obj.b = 20; int c = obj.addition(); System.out.println("Sum: " + c); } }