tag:blogger.com,1999:blog-2056945240977755077.post2549898255336805320..comments2023-10-26T19:39:08.370+05:30Comments on JAVA CRACKERS: JAVA CODE QUESTIONgautamhttp://www.blogger.com/profile/09042670047196847848noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-2056945240977755077.post-73362508021857782792007-08-03T18:51:00.000+05:302007-08-03T18:51:00.000+05:30HERE IS THE ANSWERclass A {int i=10;}public class ...HERE IS THE ANSWER<BR/><BR/>class A {<BR/>int i=10;<BR/>}<BR/>public class Demo1 {<BR/>public static void main(String str[]) {<BR/>try {<BR/>Class c=Class.forName("A");//Returns the Class object associated with the class with the given string name<BR/>Object o=c.newInstance();//Creates a new instance of the class represented by this Class object.<BR/>A a=(A) o;//casting<BR/><BR/>System.out.println(a.i);<BR/>}<BR/>catch(Exception e){<BR/>System.out.println("Exception"+e);<BR/>}<BR/>}<BR/>}gautamhttps://www.blogger.com/profile/09042670047196847848noreply@blogger.com