in Education by
How to get difference between two dates? (a) long diffInMilli = java.time.Duration.between(dateTime1, dateTime2).toMillis(); (b) long diffInMilli = java.time.difference(dateTime1, dateTime2).toMillis(); (c) Date diffInMilli = java.time.Duration.between(dateTime1, dateTime2).toMillis(); (d) Time diffInMilli = java.time.Duration.between(dateTime1, dateTime2).toMillis(); I got this question in quiz. This key question is from Data Type-Date, TimeZone topic in chapter Data Types, Variables and Arrays of Java Select the correct answer from above options Java questions and answers, Java questions pdf, Java question bank, Java questions and answers pdf, mcq on Java pdf, Java questions and solutions, Java mcq Test , Interview Java questions, Java Questions for Interview, Java MCQ (Multiple Choice Questions),Core Java Questions, Core Java MCQ,core java interview questions for experiencedcore java interview questions for 3 years experience,java programming questions,core java interview questions for freshers,java interview questions and answers for freshers, java programming questions and answers pdf, java interview questions for beginners

1 Answer

0 votes
by
 
Best answer
The correct option is (a) long diffInMilli = java.time.Duration.between(dateTime1, dateTime2).toMillis(); For explanation I would say: Java 8 provides a method called between which provides Duration between two times.

Related questions

0 votes
    What is the difference between length() and size() of ArrayList? (a) length() and size() return ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    What is the difference between TreeSet and SortedSet? (a) TreeSet is more efficient than SortedSet (b) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    What is difference between dequeue() and peek() function of java? (a) dequeue() and peek() remove ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    What is the difference between Queue and Stack? (a) Stack is LIFO; Queue is FIFO (b) Queue is ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    How to get prints of shared object memory maps or heap memory maps for a given process? (a) jmap ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of this method of class StringBuffer is used to get the length of the sequence of characters? (a ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of these method of httpd class is used to get report on each hit to HTTP server? (a) log( ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Do we have get(Object o) method in HashSet. (a) True (b) False The question was posed to me ... java programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    What is the process of defining two or more methods within same class that have same name but different ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of these can be used to differentiate two or more methods having the same name? (a) Parameters ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of these operators can be used to concatenate two or more String objects? (a) + (b) += ( ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of these method of class String is used to compare two String objects for their equality? (a) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    If two threads access the same hashmap at the same time, what would happen? (a) ConcurrentModificationException ... and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    When two threads access the same ArrayList object what is the outcome of the program? (a) Both are ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
...