in Education by
What is Optional object used for? (a) Optional is used for optional runtime argument (b) Optional is used for optional spring profile (c) Optional is used to represent null with absent value (d) Optional means it’s not mandatory for method to return object The question was asked in final exam. My doubt is from Java 8 Features topic in chapter Autoboxing & Miscellaneous of Java Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Correct answer is (c) Optional is used to represent null with absent value Explanation: Optional object is used to represent null with absent value. This class has various utility methods to facilitate code to handle values as ‘available’ or ‘not available’ instead of checking null values.

Related questions

0 votes
    SessionFactory is a thread-safe object. (a) True (b) False The question was asked in final exam. The doubt ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following methods returns proxy object? (a) loadDatabase() (b) getDatabase() (c) load() (d) ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is not a state of object in Hibernate? (a) Attached() (b) Detached() (c) ... Autoboxing & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    JUnits are used for which type of testing? (a) Unit Testing (b) Integration Testing (c) System Testing (d) ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which method is used to create a directory with fileattributes? (a) Path.create() (b) Path.createDirectory() ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which method can be used to check fileAccessiblity? (a) isReadable(path) (b) isWritable(path) (c) ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following method is used inside session only? (a) merge() (b) update() (c) end() (d ... Autoboxing & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    What data structure should be used when number of elements is fixed? (a) Array (b) Array list (c) Vector ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which jar provides FileUtils which contains methods for file operations? (a) file (b) apache commons (c) ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is a best practice to measure time taken by a process for execution? (a) System. ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the below statement about JUnit is false? (a) It is an open source framework (b) It provides an ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the below is an incorrect annotation with respect to JUnits? (a) @Test (b) @BeforeClass (c) @Junit ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of these is not a mocking framework? (a) EasyMock (b) Mockito (c) PowerMock (d) MockJava I had ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of the following is not introduced with Java 8? (a) Stream API (b) Serialization (c) Spliterator (d) ... & Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    What is the purpose of BooleanSupplier function interface? (a) represents supplier of Boolean-valued results (b) ... of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
...