Java OOP Utility classes
Flashcard 1:
Q: What is the root class of all classes in Java?
A: Object class.
Flashcard 2:
Q: What does the LocalDate class represent?
A: A date without a time-zone in the ISO-8601 calendar system (e.g., 2007-12-03).
Flashcard 3:
Q: How does LocalDateTime differ from LocalDate?
A: LocalDateTime represents a date-time without a time-zone, including year, month, day, hour,
minute, and second.
Flashcard 4:
Q: What is the main difference between java.util.Date and java.sql.Date?
A: java.util.Date stores date-time, while java.sql.Date stores only the date, commonly used in JDBC.
Flashcard 5:
Q: What additional functionality does Timestamp offer over java.util.Date?
A: Timestamp can hold SQL TIMESTAMP values with nanosecond precision.
Flashcard 6:
Q: What is the purpose of the Random class in Java?
A: To generate a stream of pseudorandom numbers.
Flashcard 7:
Q: What can the Scanner class do?
A: It parses primitive types and strings using regular expressions.
Flashcard 8:
Q: What is the Math class used for in Java?
A: Performing basic mathematical operations and providing constants.
Flashcard 9:
Q: Write a method to display today's date in YYYY-MM-DD format.
A: Method name: displayTodaysDate.
Flashcard 10:
Q: How can you create a specific date, like 19th August 2025, in Java?
A: Use a method like createSpecificDate to return a date object for 2025-8-19.
Flashcard 11:
Java OOP Utility classes
Q: What method can you write to compare two dates entered by the user?
A: areDatesEqual method, returning true if dates are equal and false if not.
Flashcard 12:
Q: How can you check if today is a specific date, like 10th December 2019?
A: Use a method named isTodaySpecificDate to compare today's date.
Flashcard 13:
Q: Describe a method to add weeks to today's date in Java.
A: addWeeksToToday(int n) where n is the number of weeks to add.
Flashcard 14:
Q: How can you determine the day of the week for a specific date?
A: Use findDayOfWeek, which takes a date and returns the day (e.g., "Wednesday").
Flashcard 15:
Q: What is a way to calculate the days between two dates in Java?
A: daysBetween method reads two dates and computes the difference in days.
Flashcard 16:
Q: How can you verify if a date string conforms to the YYYY-MM-DD format?
A: isValidDate method checks the format and validates leap years if applicable.
Flashcard 17:
Q: Write a method to show the elapsed time since a prior time.
A: elapsedTimeSince, input format HH:MM:SS, displays the time span to present.
Flashcard 18:
Q: How can you convert a date and time across different time zones?
A: convertToTimeZone method, using date, time, and timezone input to show adjusted time.
Flashcard 19:
Q: What attributes are included in an Event class for scheduling?
A: eventName, eventDescription, eventDateTime, and reminderDateTime.
Flashcard 20:
Q: What does the Scheduler class manage in an event scheduling application?
A: Scheduler manages a list of events, adds or removes events, and retrieves reminders.