Question
import java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c = Class.forName("java.awt.Dimension");
Constructor constructors[] = c.getConstructors();
for (int i = 0; i < constructors.length; i++)
System.out.println(constructors[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}
a.
Program prints all the constructors of ‘java.awt.Dimension’ package
b.
Program prints all the possible constructors of class ‘Class’
c.
Program prints “Exception”
d.
Runtime Error
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. Which of these type parameters is used for a generic class to return and accept any type of object?
View solution
Q. Which of these type parameters is used for a generic class to return and accept a number?
View solution
Q. Which of these is an correct way of defining generic class?
View solution
Q. Which of the following is an incorrect statement regarding the use of generics and parameterized types in Java?
View solution
Q. Which of the following reference types cannot be generic?
View solution
Q. A java interface can contain _______.
View solution
Q. Which of the following is a correct interface?
View solution
Q. Which of the following classes directly implement Set interface?
View solution
Q. Which is the correct way to inherit and implement the interface?
View solution
Q. Which of the following is true about methods in an interface in java?
View solution
Q. Can "abstract" keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization Block.
View solution
Q. Package in Java is a mechanism to encapsulate a ______________.
View solution
Q. Package names and directory structure are closely related.
View solution
Q. An _______________ statement can be used to access the classes and interface of a different package from the current package.
View solution
Q. Which of the following packages is used to includes classes to create user interface like Button and Checkbox?
View solution
Q. Which of the following packages is used to includes utility classes like Calendar, Collection, Date?
View solution
Q. Which of the following is the correct way of importing an entire package "pkg"?
View solution
Q. Which of the following is false statement about package in java?
View solution
Q. Packages that are inside another package are the _________
View solution
Q. An interface in Java is like a 100% ____.
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!