Question: in Java, using several Jar files, one of them must be json-org. java(any version is fine). Note that you should only upload the jars, not
in Java, using several Jar files, one of them must be json-org. java(any version is fine). Note that you should only upload the jars, not source files.
Write a program called JarClasses.java that takes a jar file as command line argument and prints out a listing of all the classes inside, as well as the number of declared public, private, protected, and static methods for each, and the number of declared fields for each.
The listing should be sorted alphabetically on the name of the classes. Your program must use reflection to get the required information about the methods and fields of each class.
For example, the command line and output for json-java.jar is: $ java JarClasses json-java.jar
----------org.json.CDL---------- Public methods: 9 Private methods: 1 Protected methods: 0 Static methods: 10 Fields: 0 ----------org.json.Cookie---------- Public methods: 4 Private methods: 0 Protected methods: 0 Static methods: 4 Fields: 0 ----------org.json.CookieList---------- Public methods: 2 Private methods: 0 Protected methods: 0 Static methods: 2 Fields: 0 ----------org.json.HTTP---------- Public methods: 2 Private methods: 0 Protected methods: 0 Static methods: 2 Fields: 1 ----------org.json.HTTPTokener---------- Public methods: 1 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 0 ----------org.json.JSONArray---------- Public methods: 72 Private methods: 5 Protected methods: 0 Static methods: 2 Fields: 1 ----------org.json.JSONException---------- Public methods: 0 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 1 ----------org.json.JSONML---------- Public methods: 10 Private methods: 1 Protected methods: 0 Static methods: 11 Fields: 0 ----------org.json.JSONObject---------- Public methods: 78 Private methods: 11 Protected methods: 3 Static methods: 27 Fields: 3 ----------org.json.JSONObject$1---------- Public methods: 0 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 0 ----------org.json.JSONObject$Null---------- Public methods: 3 Private methods: 0 Protected methods: 1 Static methods: 0 Fields: 0 ----------org.json.JSONPointer---------- Public methods: 4 Private methods: 3 Protected methods: 0 Static methods: 4 Fields: 2 ----------org.json.JSONPointer$Builder---------- Public methods: 3 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 1 ----------org.json.JSONPointerException---------- Public methods: 0 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 1 ----------org.json.JSONPropertyIgnore---------- Public methods: 0 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 0 ----------org.json.JSONPropertyName---------- Public methods: 1 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 0 ----------org.json.JSONString---------- Public methods: 1 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 0 ----------org.json.JSONStringer---------- Public methods: 1 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 0 ----------org.json.JSONTokener---------- Public methods: 16 Private methods: 2 Protected methods: 0 Static methods: 1 Fields: 8 ----------org.json.JSONWriter---------- Public methods: 10 Private methods: 4 Protected methods: 0 Static methods: 1 Fields: 6 ----------org.json.Property---------- Public methods: 2 Private methods: 0 Protected methods: 0 Static methods: 2 Fields: 0 ----------org.json.XML---------- Public methods: 14 Private methods: 5 Protected methods: 0 Static methods: 19 Fields: 11 ----------org.json.XML$1---------- Public methods: 1 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 1 ----------org.json.XML$1$1---------- Public methods: 4 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 3 ----------org.json.XMLParserConfiguration---------- Public methods: 10 Private methods: 0 Protected methods: 2 Static methods: 0 Fields: 7 ----------org.json.XMLTokener---------- Public methods: 6 Private methods: 0 Protected methods: 0 Static methods: 1 Fields: 1 ----------org.json.XMLXsiTypeConverter---------- Public methods: 1 Private methods: 0 Protected methods: 0 Static methods: 0 Fields: 0
Please help me ensure the code you provided is going to work "out-of-the-box" as needed and will run the command line input example of Java JarClasses java-json.jar assuming the file java-json.jar is in the appropriate directory etc. Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
