Professional Documents
Culture Documents
class Main {
// create strings
// print strings
System.out.println(S1);
OBJECT
An object contains functions and variables that are accessible when instantiated in the main
class.
void bark() {
System.out.println("Woof-Woof");
class Main {
Class: - is used to create objects. A class contains a set of properties and methods that are
common and exhibited by all the objects of the class. It contains fields and methods that
represent the behaviour of an object. A class gets invoked by the creation of the respective object.
Enum - An enum has attributes, methods, and constants - that are public, static, and final
(unchangeable – cannot be overridden). An enum cannot be used to create objects and it cannot
extend other classes. But, the enum can implement interfaces.
//declaration of an enum
enum Level {
LOW,
MEDIUM,
HIGH
Interface:
All the variables and methods declared inside the interface are by default abstract.
The methods don't have a body and just the method declaration only. The interface is
also known as a fully abstract class.
interface Animal {
System.out.println("omnomnom");