Advanced Java Interview Questions and Answers For Freshers and Experience Part-13
The File class is used to create objects that provide access to the files and directories of a local file system.
116. Can an exception be rethrown?
Yes, an exception can be rethrown.
117. Which Math method is used to calculate the absolute value of a number?
The abs() method is used to calculate absolute values.
118. 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.
119. 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.
120. 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.