Question: The following code error occurred and I added this code and the error disappeared. What is the reason? import java.lang.reflect.*; public class ObjectTest { public
The following code error occurred and I added this code and the error disappeared. What is the reason?
import java.lang.reflect.*;
public class ObjectTest { public static void main (String []args )throws Exception { int count=0; Class c = Class.forName ("java.lang.Object"); Method[]m = c.getDeclaredMethods(); for( Method mi:m ) { System.out.println (mi.getName()); count++; } System.out.println ("number of methods in object class:" + count); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
