Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java
Program 1
@FunctionalInterface
interface MyInter
{
void display();
}
class TestAnnotation
{
public static void main(String args[])
{
MyInter M1=()->{System.out.println("Hello Friends ");};
M1.display();
}
}
// class MyClass
// {
// void a1()
// {
// System.out.println("Hello This is a1 method");
// }
// @Deprecated
// void a2()
// {
// System.out.println("Hello This is a2 method this method in java 1.2 version");
// }
// }
// class TestAnnotation
// {
// public static void main(String args[])
// {
// MyClass M1=new MyClass();
// M1.a1();
// M1.a2();
// }
// }
// abstract class Base
// {
// @Override
// abstract void displayData();
// }
// class Derived extends Base
// {
// void displayData()
// {
// System.out.println("This is display data of Derived class method");
// }
// }
// class TestAnnotation
// {
// public static void main(String args[])
// {
// Derived D=new Derived();
// D.displayData();
// }
// }
//import java.util.*;
// @SuppressWarnings("unchecked")
// class TestAnnotation
// {
// public static void main(String args[])
// {
// ArrayList A=new ArrayList();
// A.add("Indore");
// A.add("Pune");
// A.add("Delhi");
// A.add(123);
// A.add(true);
// for(Object O:A)
// {
// System.out.println(O);
// }
// }
// }