Is there any need to import java.lang package?

Answer Posted / navneet raushan

Hi Rakesh .. I m writing the code
import java.lang.reflect.*;

public class DumpMethods {
public static void main(String args[])
{
try {
Class c = Class.forName(args[0]);
Method m[] = c.getDeclaredMethods();
for (int i = 0; i < m.length; i++)
System.out.println(m[i].toString());
}
catch (Throwable e) {
System.err.println(e);
}
}
}

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an interface in java?

569


What are the three parts of a lambda expression?

540


What is the exception hierarchy in java?

492


What is the difference between Java Program Constructor and Java Program Method, What is the purpose of Java Program constructor Please Explain it Breafily?

604


Why array is used in java?

521






How to find the given number is a prime number or not by getting input from the user

557


What do you mean by byte code?

521


What does the append?

501


Give the difference between the println method and sqrt method?

633


Can a static class have a constructor java?

554


What is basic syntax?

555


What are predicates in java 8?

537


What is bufferedwriter?

544


What is a functional interface?

550


Is an integer an object?

522