0% found this document useful (0 votes)
4 views1 page

Java 8 Questions

Uploaded by

Gogula Ram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Java 8 Questions

Uploaded by

Gogula Ram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1: Lambda Expressions

Write a lambda expression that takes two integers and returns their sum.
2: Stream API
Given a list of strings, use the Stream API to find and print all the strings that start with
the letter "A".
3: Default Methods
Create an interface named Shape with a default method draw() that prints "Drawing
shape". Then, implement this interface in a class Circle and override the draw() method
to print "Drawing circle".
4: Optional API
Given an Optional<String> variable, write code to print the value if present. If the value is
not present, print "No value found".
5: Date API
Using the new Date API in Java 8, write code to get the current date and then add 5
days to it.

You might also like