Answer the question
In order to leave comments, you need to log in
How to rewrite c# code to java?
Hello, how can I rewrite c# code in java. It is necessary that the Android application receive the content of the URL
WebClient wc = new WebClient();
string response = wc.downloadString("example.com/api");
Answer the question
In order to leave comments, you need to log in
Of. documentation
Will output 100 json objects.
import java.net.*;
import java.io.*;
public class URLReader {
public static void main(String[] args) throws Exception {
URL oracle = new URL("http://jsonplaceholder.typicode.com/posts");
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question