Set - 6

Question 16 :

What is the difference between static and non-static variables?

Answer :

A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

Question 17 :

What is the difference between the paint() and repaint() methods?

Answer :

The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.

Question 18 :

What is the purpose of the File class?

Answer :

The File class is used to create objects that provide access to the files and directories of a local file system.

Question 19 :

Can an exception be rethrown?

Answer :

Yes, an exception can be rethrown.

Question 20 :

Which Math method is used to calculate the absolute value of a number?

Answer :

The abs() method is used to calculate absolute values.