热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

Java 8 面试题与答案

Test your skills through the online practice test: Java 8 Quiz Online Practice Test

相关差异对比

Java 7 vs Java 8Java 8 vs Java 9

问题 11. What is the difference between Predicate and Function?

Both are functional interfaces.
  • Predicate<T> is single argument function and either it returns true or false. This can be used as the assignment target for a lambda expression or method reference.
  • Function<T,R> is also single argument function but it returns an Object. Here T denotes type of input to the function and R denotes type of Result. This can also be used as the assignment target for a lambda expression or method reference.

这有帮助吗? 添加评论 查看评论
 

问题 12. What the issues with Old Date and time API before Java 8? Date and Time API differences between Java 8 and earlier Java version.

Issues with old Date and Time API:
  • Thread Safety: You might be already aware that java.util.Date is mutable and not thread safe. Even java.text.SimpleDateFormat is also not Thread-Safe. New Java 8 date and time APIs are thread safe.
  • Performance: Java 8 new APIs are better in performance than old Java APIs.
  • More Readable: Old APIs such Calendar and Date are poorly designed and hard to understand. Java 8 Date and Time APIs are easy to understand and comply with ISO standards.

这有帮助吗? 添加评论 查看评论
 

问题 13. Provide some APIs of Java 8 Date and Time.

LocalDate, LocalTime, and LocalDateTime are the Core API classes for Java 8. As the name suggests, these classes are local to context of observer. It denotes current date and time in context of Observer.

这有帮助吗? 添加评论 查看评论
 

问题 14. How will you get current date and time using Java 8 Date and TIme API?

You can simply use now() method of LocalDate to get today’s date.
LocalDate currentDate = LocalDate.now();
System.out.println(currentDate);

Output:
2017-09-09

You can use now() method of LocalTime to get current time.
LocalTime currentTime = LocalTime.now();
System.out.println(currentTime);
 
Output:
23:17:51.817

这有帮助吗? 添加评论 查看评论
 

问题 15. Do we have PermGen in Java 8? What is MetaSpace in Java 8?

Until Java 7, JVM used an area called PermGen to store classes. It got removed in Java 8 and replaced by MetaSpace.
Major advantage of MetaSpace over permgen:
PermGen was fixed in term of maximum size and can not grow dynamically but Metaspace can grow dynamically and do not have any size constraint.

这有帮助吗? 添加评论 查看评论
 

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。