Enumerated Data Types In Java
Enumerated data types (or enums for short) are newly introduced in Java 5.0. Enums will let us choose a value from a pre-defined list of values. Each value in this pre-defined list are called “enums”. Using enums we can restrict the values thus by reducing bugs in our code. Suppose, if we are developing payroll application, we need to have certain employee types. For example, permanent employee, contract employee, full time employee and part-time employee etc. In order to provide these employee types, we can create an enum with these pre-defined employee types as shown below: enum EmployeeType { PERMANENT, […]
Enumerated Data Types In Java Read More »