填空题

In the context of Java, what is the reasoning behind the generally accepted design principle "Favor composition over inheritance"?

下载APP答题
由4l***dq提供 分享 举报 纠错

相关试题

填空题 What is meant by a side-effect in the context of a method call with reference type arguments?

填空题 Given the following class:class User { private String name; private int age; // Constructor that takes the two above properties // Getter and setters for name and age }

And the following array:

User[] users = new User[] { new User("John", 20), new User("Mike", 18), new User("John", 30) };


Which option represents a comparator that will sort the array by name, and the values with the same name will sort them by age ascending?

填空题 What does it mean that Java passes reference method arguments by value?

填空题  

Consider the following Java functional interface:

interface StringValidator { boolean test(String s); default boolean initialTest(String s) { return !s.isEmpty(); } }

Which of the following represents a change that will make StringValidator NOT be a functional interface anymore?

填空题 If you create a class called MyClass and then create a local variable of type MyClass, what can this variable contain?

填空题 What is the main difference between intermediate and terminal Java Stream operations?

填空题  

What is meant by the "fall through" scenario in the context of a Java switch statement?

填空题 Consider the following code snippet:    public static void main(String[] args) { String[] numbers = new String[]{"one", "two", "three"}; for (int i = 0; _________; i++) { System.out.println(numbers[i]); } }


Assuming you want to display all numbers, which of the following answers is the correct termination statement missing in the above for statement?