in JAVA by
Q:

   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.

Compilation error

Runtime error: Null pointer Exception

Java optional example

String value is not present

Related questions

0 votes
asked Feb 6, 2020 in JavaScript by rajeshsharma
0 votes
asked Jan 31, 2020 in Other by MBarbieri
0 votes
asked Jan 23, 2020 in Data Science by AdilsonLima
0 votes
asked Jan 23, 2020 in Data Science by AdilsonLima
+2 votes
asked Jan 21 in C Plus Plus by SakshiSharma
...