Advanced Java - Interview Questions and Answers
What is the purpose of the File class?
The File class is used to create objects that provide access to the files and directories of a local file system.
Can an exception be rethrown?
Yes, an exception can be rethrown.
Which Math method is used to calculate the absolute value of a number?
The abs() method is used to calculate absolute values.
How does multithreading take place on a computer with a single CPU?
The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
When does the compiler supply a default constructor for a class?
The compiler supplies a default constructor for a class if no other constructors are provided.
When is the finally clause of a try-catch-finally statement executed?
The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause.