1. Java classes start with capitals, so the class should be ReadJson, not readJson.
2. You can't have code outside of a method (hint: see line 10 of your erroring class)
3. Classes don't throw exceptions, methods do.
Well, class names should be nouns, so the name should really be JsonReader.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Joined: Nov 26, 2010
Hi yes I realized it and already change it .
Thanks for the info
I manage to separate the json file, so now I can show each token separately.
What I am trying to do is to to save the number of users and their details from the json string
Here is the user class I made
This class has all the variables, the string I want to get the data from has details such as when the file was created and all the users in that file.
I want to store the data in a way that it shows :
Completed in: times
query: the search query used
Number of users: integer
and then show the user two details
show the user 3 details etc....
How do I save it so that users are saved in an array calling the User class I have created.
Here is the code I am trying to make but I don't know how to continue:
[Edit]Hope you haven’t used line numbers; your comment was so long and difficult to read, that I divided it into 5 lines. CR[/edit]
Joined: Nov 26, 2010
This is the code I am using to save it in an array but with no success
First I made an instance of the UsedID class in an array
I, then stored the value in by calling that class in the same way as I done with the other values ,but in this case it's an array.
John de Michele
Joined: Mar 09, 2009
Another niggly style issue: member variable names should be in Camel Case, starting with a lowercase letter. Underscores between words should be avoided, unless you're doing a static final in all uppercase.
You are also using inconsistent indentation. Don’t use tabs for indenting. Use spaces. Follow the keyword if with a single space. Don’'t try to compress a method into one line. A “getXXX” method returning a boolean should be called “isXXX” or “hasXXX”.
All little things, but inconsistencies make it harder to read your code.
subject: Extracting data from a JSON file/URL/Object/String in Java