Professional Documents
Culture Documents
Unit 4-2mark
Unit 4-2mark
Unit 4-2mark
3. What is the difference between extending the Thread class and implementing the
Runnable interface for creating threads in Java?
When extending the Thread class, your class is tightly coupled with the thread behavior,
and you cannot extend any other class. When implementing the Runnable interface, your
class can still extend another class, and you can pass instances of your class to multiple
threads if needed, promoting better code organization and reusability.
29. How does the GregorianCalendar class differ from the Calendar class?
30. The GregorianCalendar class is a specific implementation of the abstract Calendar class
that follows the Gregorian calendar system. It provides additional functionality and
precision for working with dates and times compared to the abstract Calendar class,
which serves as a base for various calendar implementations.