Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Which of the following methods preserve parameter names in Java

bytecode (through reflection API)?

All methods

In Java 8, Static methods cannot be added to an Interface.

False

The following code includes a valid Functional Interface.

package functionalInterfaceExample;

@FunctionalInterface
public interface MyFirstFunctionalInterface {
public void firstWork();
@Override
public String toString();
@Override
public boolean equals(Object obj);
}

True

Identify the intermediate and terminal operations in the code.

double average = roster


.stream()
.filter(p -> p.getGender() == Person.Sex.MALE)
.mapToInt(Person::getAge)
.average()
.getAsDouble();

Intermediate: filter, mapToInt Terminal: average

Which package contains Date/Time (JSR 310) API in Java 8?

java.time

Which of the following is correct about Java 8 lambda expression?

Both the options

DateTimeFormatter formatter=DateTimeFormatter.ofPattern("EEEE",Locale.US);
System.out.println(formatter.format(LocalDateTime.now()));

Choose the correct output.

Friday

Which method is used to connect the consumer to the source in reactive


programming?

subscribe()

import java.time.Clock;
public class App{
public static void main(String [] args){
final Clock clock=Clock.systemUTC();
System.out.println(clock.instant());
System.out.println(clock.millis());
}
}

The output for the above code is __________

Compilation error

PermGen space has been replaced with which of these in Java 8?

Metaspace

You might also like