-
What is the output of this program?
import java.lang.reflect.*;
public class Additional_packages_Example
{
public static void main(String args[])
{
try
{
Class obj = Class.forName("java.awt.Dimension");
Field fields[] = obj.getFields();
for (int k = 0; k < fields.length; k++)
System.out.println(fields[k]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}
-
- Program prints all the methods of ‘java.awt.Dimension’ package
- Program prints all the data members of ‘java.awt.Dimension’ package
- program prints all the methods and data member of ‘java.awt.Dimension’ package
- Program prints all the constructors of ‘java.awt.Dimension’ package
- None of these
Correct Option: B
Program prints all the data members of ‘java.awt.Dimension’ package