Looking for *Програмування на Jаvа test answers and solutions? Browse our comprehensive collection of verified answers for *Програмування на Jаvа at dl.nure.ua.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Suppose we have a class named Rabbit. Which of the following statements are true? (Choose all that apply)
1: public class Rabbit {
2: public static void main(String[] args) {
3: Rabbit one = new Rabbit();
4: Rabbit two = new Rabbit();
5: Rabbit three = one;
6: one = null;
7: Rabbit four = one;
8: three = null;
9: two = null;
10: two = new Rabbit();
11: System.gc();
12: } }
Which of the following statements are true? (Choose all that apply.)
What is the result of the following program?
1: public abstract class Message {
2: public String recipient;
3: public abstract final void sendMessage();
4: public static void main(String[] args) {
5: Message m = new TextMessage();
6: m.recipient = "1234567890";
7: m.sendMessage();
8: }
9: static class TextMessage extends Message {
10: public final void sendMessage() {
11: System.out.println("Text message to " + recipient);
12: } } }
Given the following class, which of the following calls print out Blue Jay? (Choose all that apply)
public class BirdDisplay {
public static void main(String[] name) {
System.out.println(name[1]);
} }
What is the result of the following code?
1: public class Hello<T> {
2: T t;
3: public Hello(T t) { this.t = t; }
4: public String toString() { return t.toString(); }
5: public static void main(String[] args) {
6: System.out.print(new Hello<String>("hi"));
7: System.out.print(new Hello("there"));
8: } }
Which of the following return primitives? (Choose all that apply.)
What is the result of the following code?
1: public class VisitPark {
2: enum AnimalsInPark {
3: SQUIRREL, CHIPMUNK, SPARROW;
4: }
5: public static void main(String[] args) {
6: AnimalsInPark[] animals = AnimalsInPark.values();
7: System.out.println(animals[1]);
8: } }
Which functional interfaces complete the following code? (Choose all that apply.)
6: ____________ x = String::new;
7: ____________ y = (a, b) -> System.out.println();
8: ____________ z = a -> a + a;
Which of the following is equivalent to this code?
UnaryOperator<Integer> u = x -> x * x;
Which of the answer choices make sense to implement with a lambda? (Choose all that apply.)