Menu

[Solved]1 Functional Interface Number Abstract Methods B Used Target Lambda Expression C Implement Q37222415

1. A functional interface…

A) can have any number of abstract methods

B) can be used as a target for a lambda expression

C) can implement any number of methods other than the ‘default’and ‘static’ types

D) requires the @AbstractInterface annotation so the compilercan recognize it

2. In a generic class genericClass<T>…

A) inner generic classes with the type parameter T are notallowed (i.e., innerClass<T>)

B) it is possible to instantiate arrays of generic type T (i.e.,EClass<T>[] genArray = newEClass<T>{10};)

C) constructors have to be declared as: genericClass<T>(zero or more parameter list…)

D) generic object initializations are allowed (i.e.,EClass<T> ref = newEClass<T>(var))

3. The following piece of code:

ArrayList<int testList- new ArrayListint>(O testList.add(1); testList.add( -2); int sum1 for (Integer item testList) sum item

a) will issue a compile-time unexpected type error message

b) will display the integer 5 on the console

c) will issue a runtime invalid assignment error message

d) will display the integer 4 on the console

4. The following processing of an array of integers results indisplaying the following integer on the console:

int [ ][ ] a_ {{4, 3, 2}, {1, -5, 6}, {8, 7. -9}}; for (int = 0; i < 3; i++) for (i = j ; j < 3; j++) sum += a[1] [j ] ; Syst

a) 0

b) 1

c) 17

d) -10

5. The interface SimpleLambda, defined as:

@FunctionalInterface public interface SimpleLambda public void doSomething):) is a target type for thefollowing expression:

A) x -> System.out.println(x);

B) (x) -> x + 1;

C) () -> System.out.println(x);

D) () -> System.out.println(“Hello World”);

ArrayList<int testList- new ArrayListint>(O testList.add(1); testList.add( -2); int sum1 for (Integer item testList) sum item * item; System.out.println(sum); int [ ][ ] a_ {{4, 3, 2}, {1, -5, 6}, {8, 7. -9}}; for (int = 0; i < 3; i++) for (i = j ; j < 3; j++) sum += a[1] [j ] ; System.out.println(sum); @FunctionalInterface public interface SimpleLambda public void doSomething):) Show transcribed image text ArrayList(O testList.add(1); testList.add( -2); int sum1 for (Integer item testList) sum item * item; System.out.println(sum);
int [ ][ ] a_ {{4, 3, 2}, {1, -5, 6}, {8, 7. -9}}; for (int = 0; i

Expert Answer


Answer to 1. A functional interface… A) can have any number of abstract methods B) can be used as a target for a lambda expressi… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *