Whenever I run it, it prints all the lines perfectly as it's looping through with the first print statement, however when I call that last print statement, the console displays absolutely nothing. And whenever I comment out the looped print statement, the console is completely blank. Here's my code:
public static void main(String[] args){
try {
URL url = new URL("https://maps.googleapis.com/maps/api/distancematrix/json?origins=San+Antonio&destinations=San+Francisco&key=");
URLConnection mapcon = url.openConnection();
BufferedReader buffreader = new BufferedReader(new InputStreamReader(mapcon.getInputStream()));
String reqData = new String("");
String inputLine;
while ((inputLine = buffreader.readLine()) != null){
reqData.concat(inputLine);
System.out.println(inputLine);
}
System.out.println(reqData);
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}