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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!