OOPS Lab 6
OOPS Lab 6
import java.util.function.Consumer;
@FunctionalInterface
interface MyFunctionalInterface {
void display(String message);
}
interface MyInterface {
void abstractMethod();
checkString.display("");
checkString.display("Hello, World!");
// Interface example
example.abstractMethod();
example.defaultMethod();
MyInterface.staticMethod();
class OuterClass {
private String outerField = "Outer field";
class InnerClass {
public void display() {
System.out.println("Accessing outer field: " +
outerField);
}
}