-
What is the output of this program?
import java.lang.reflect.*;
public class Additional_package_Example
{
public static void main(String args[])
{
try
{
Class obj = Class.forName("java.awt.Dimension");
Method methods[] = obj.getMethods();
for (int k = 0; k < methods.length; k++)
System.out.println(methods[k]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}
-
- Exception
- Program prints all the constructors of ‘java.awt.Dimension’ package.
- program prints all the methods and data member of ‘java.awt.Dimension’ package.
- Program prints all the data members of ‘java.awt.Dimension’ package.
- Program prints all the methods of ‘java.awt.Dimension’ package.
Correct Option: E
Program prints all the methods of ‘java.awt.Dimension’ package.
public double java.awt.Dimension.getWidth()
public double java.awt.Dimension.getHeight()
public boolean java.awt.Dimension.equals(java.lang.Object)
public java.lang.String java.awt.Dimension.toString()
public int java.awt.Dimension.hashCode()
public java.awt.Dimension java.awt.Dimension.getSize()
public void java.awt.Dimension.setSize(double,double)
public void java.awt.Dimension.setSize(int,int)
public void java.awt.Dimension.setSize(java.awt.Dimension)
public java.lang.Object java.awt.geom.Dimension2D.clone()
public void java.awt.geom.Dimension2D.setSize(java.awt.geom.Dimension2D)
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public final native java.lang.Class java.lang.Object.getClass()
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()