Multiple choice

Which of the following methods cannot be invoked from the instance of Frame class in AWT?

  1. setLocation(int, int)

  2. setVisible(Boolean)

  3. setSize(int, int)

  4. setSize(int, int)

  5. Pack()

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This function is not defined in the Frame class. This function is defined in JFrame class in Swings. So, this method cannot be invoked using the object of Frame class. But, can be invoked using the Object of JFrame class. This method specifies the operation when the frame is closed. Hence, this would be false. Frame f1 = new frame();f1.setDefaultCloseOperation(int); so this is the correct answer.