ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 76 - Associate Android Developer discussion

Report
Export

For example, we have a BufferedReader reader, associated with the json file through InputStreamReader. To get a file data we can do this:

A.
String line; try {while ((line = reader.readLine()) != null) { builder.append(line);}JSONObject json = new JSONObject(builder.toString()); return json;} catch (IOException | JSONException exception) { exception.printStackTrace();}
Answers
A.
String line; try {while ((line = reader.readLine()) != null) { builder.append(line);}JSONObject json = new JSONObject(builder.toString()); return json;} catch (IOException | JSONException exception) { exception.printStackTrace();}
B.
JSONObject line; try {while ((line = reader.readJSONObject ()) != null) { builder.append(line);}JSONObject json = new JSONObject(builder.toString()); return json;} catch (IOException | JSONException exception) { exception.printStackTrace();}
Answers
B.
JSONObject line; try {while ((line = reader.readJSONObject ()) != null) { builder.append(line);}JSONObject json = new JSONObject(builder.toString()); return json;} catch (IOException | JSONException exception) { exception.printStackTrace();}
C.
String line; try {while ((line = reader.readLine()) != null) { builder.append(line);}JSONObject json = new JSONObject(builder.toString()); return json;} catch (RuntimeException|ArrayIndexOutOfBoundsException exception) { exception.printStackTrace();}
Answers
C.
String line; try {while ((line = reader.readLine()) != null) { builder.append(line);}JSONObject json = new JSONObject(builder.toString()); return json;} catch (RuntimeException|ArrayIndexOutOfBoundsException exception) { exception.printStackTrace();}
Suggested answer: A
asked 18/09/2024
Donald Wu
32 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first