SCJP刷题学习笔记(Part seven)

本文是SCJP备考的学习笔记,重点探讨了代码片段中的Stream语法,链接提供了更多关于Stream的详细解析。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

QUESTION 61

Given:

	public interface Moveable<Integer> {
		public default void walk (Integer distance) {System.out.println
		("Walking");}
		public void run(Integer distance);
		}
 
Which statement is true?
A. Moveable can be used as below:
Moveable<Integer> animal = n - > System.out.println(“Running” + n);
animal.run(100);
animal.walk(20);
B. Moveable can be used as below:
Moveable<Integer> animal = n - > n + 10;
animal.run(100);
animal.walk(20);
C. Moveable can be used as below:
Moveable animal = (Integer n) - > System.out.println(n);
animal.run(100);
Moveable.walk(20);
D. Movable cannot be used in a lambda expression.
Correct Answer: A
Section: (none)
Explanation
 
 
Explanation/Reference:
 
 
 
QUESTION 62
Which two code blocks correctly initialize a Locale variable? (Choose two.)
A. Locale loc1 = "UK";
B. Locale loc2 = Locale.getInstance("ru");
C. Locale loc3 = Locale.getLocaleFactory("RU");
D. Locale loc4 = Locale.UK;
E. Locale loc5 = new Locale ("ru", "RU");
Correct Answer: DE
Section: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 63
Given:
class FuelNotAvailException extends Exception { }
class Vehicle {
void ride() throws FuelNotAvailException { //line n
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值