No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I want to create a file by entering its name at runtime through command line argument..But i am not getting any idea about how to do that?? Please provide some help.. THANKS |
|
import java.lang.reflect.*; import java.awt.*; import java.lang.*; class SampleField { public static void getField(Class c) { //Class c= Class.forName(s); Field f[]=c.getFields(); for(int i=0;i<f.length;i++) { System.out.println(" "); Class type=f[i].getType(); System.out.print(type.getName()); System.out.print(""+f[i].getName()); } } public static void main(String... s1) { try{ Class c= Class.forName(s1[0]); getField(c); }catch(Exception e){System.out.println(e);} } } I have written the … |