Experiment No 12-13 - VV
Experiment No 12-13 - VV
Experiment No 12-13 - VV
boolean option=true;
while (option) {
System.out.println("1.peek into stack");
System.out.println("2.pop into stack");
System.out.println("3.Push into stack");
System.out.println("4.exit");
Scanner sc=new Scanner(System.in);
int choice=sc.nextInt();
switch (choice) {
case 1:{
System.out.println("top element of stack is : "+ s.peek());
break;
}
case 2:{
System.out.println("poped element is : "+ s.pop());
break;
}
case 3:{
System.out.println("element to be pushed in stack : ");
int data=sc.nextInt();
s.push(data);
break;
}
case 4:{
option=false;
break;
}
}
}
}
Output window
Experiment No 13
Aim: WAP to illustrate the difference between lambda function, anonymous
inner class implementation and method reference implementation of
functional interface
Code:
public class Main{
interface Func {
void wish(String name);
}