Java Basic
- Which feature of java 8 enables us to create a work stealing thread pool using all available processors at its target?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Executors newWorkStealingPool() method to create a work-stealing thread pool using all available processors as its target parallelism level.
- What are the two types of Streams offered by java 8?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Sequential stream and parallel stream are two types of stream provided by java.
- Which is the new method introduced in java 8 to iterate over a collection?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Traversing through forEach method of Iterable with anonymous class.
- What is the return type of lambda expression?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Lambda expression enables us to pass functionality as an argument to another method, such as what action should be taken when someone clicks a button.
- Which of the below is an incorrect annotation with respect to JUnits?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
@Test is used to annotate method under test, @BeforeEach and @AfterEach are called before and after each method respectively. @BeforeClass and @AfterClass are called only once for each class.