public class ShowcaseApp {
public static void main(String[] args) {
System.out.println("=== Showcase Program Started ===");
ExampleClass obj = new ExampleClass("DemoObject", 42);
obj.display();
for (int i = 0; i < 5; i++) {
obj.process(i);
}
DerivedClass derived = new DerivedClass("ChildExample", 7);
derived.display();
derived.specialAction();
Utility.printDivider();
Utility.randomText();
Utility.endProgram();
}
}
class ExampleClass {
private String name;
private int number;
public ExampleClass(String name, int number) {
this.name = name;
this.number = number;
}
public void display() {
System.out.println("Name: " + name + " | Number: " + number);
}
public void process(int value) {
System.out.println("Processing value: " + value);
}
}
class DerivedClass extends ExampleClass {
public DerivedClass(String name, int number) {
super(name, number);
}
public void specialAction() {
System.out.println("DerivedClass executing special action...");
}
}
class Utility {
public static void printDivider() {
System.out.println("-------------------------------");
}
public static void randomText() {
String[] texts = {"Alpha", "Beta", "Gamma", "Delta", "Omega"};
for (String t : texts) {
System.out.println("Random Text: " + t);
}
}
public static void endProgram() {
System.out.println("=== Showcase Program Ended ===");
}
}