5. It will compile and run with FileAlreadyExistsException
Correct Answer : Get Lastest Questions and Answer : Explanation: : As you know, finally will be executed which will create an object of Exception class which will be catched in main method. Using dynamic binding it will use actual type of Object. Hence, it will print Exception
Question : You have been given following code, what is the behavior expected
Correct Answer : Get Lastest Questions and Answer : Explanation: As you know, when we are using between method of Period class, it should have been used like between(start date, end date) . Here we are using in reverse order hence, it will give -2 instead of 2.
Question : Which one of the following classes is best suited for storing timestamp values of application events in a file? 1. java.time.ZoneId class
Correct Answer : Get Lastest Questions and Answer : Explanation: The Instant class stores the number of seconds elapsed since the start of the Unix epoch (1970-01-01T00:00:00Z). The Instant class is suitable for storing a log of application events in a file as timestamp values. The ZoneId and ZoneOffset classes are related to time zones and hence are unrelated to storing timestamp values. The Duration class is for time-based values in terms of quantity of time (such as seconds, minutes, and hours). The Period class is for date-based values such as years, months, and days.