Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
general knowledge
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
beans
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 
Men Jacket


Choose the correct option based on this code segment in Java8 Innards
Question Posted on 01 Jan 2021

Home >> Java >> Java8 Innards >> Choose the correct option based on this code segment in Java8 Innards




Choose the correct option based on this code segment in Java8 Innards
import java.util.Optional;
public class App {
public static void main(String[] args) {
String[] str = new String[10];
str[5] = null;;
str[4] = "JAVA OPTIONAL CLASS EXAMPLE";
Optional< String> checkNull = Optional.ofNullable(str[5]);
if(checkNull.isPresent()){ // It Checks, value is present or not
String lowercaseString = str[5].toLowerCase();
System.out.print(lowercaseString);
}else
System.out.println("String value is not present");
}
}
Choose the correct output.
(1)String value is not present
(2)Runtime error: Null pointer Exception
(3)Java optional example
(4)Compilation error

Answer:-(1)String value is not present
0
0



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
Choose the correct option based on this code segment
Which of the following is correct about Java 8 lambda expression?
In Functional Reactive programming, we pull the stream of data.
Stream operation iterations are internal over the source of elements.
Choose the correct option based on this code segment in Java8 Innards Qsn






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |