title: The Method is undefined for the type object
body: <p>I have been researching this however I can't seem to correct the error. I have a "The Method is undefined for the type object" error on both <code>getStatusCode()</code> and <code>getReasonPhrase()</code>. Any help would be appreciated.</p>
  
  <p><a href="https://i.stack.imgur.com/ld835.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ld835.png" alt="enter image description here"></a>
  My code is as follows</p>
  
  <pre><code>package com.javapapers.java.io;
  
  import org.apache.http.HttpEntity;
  import org.apache.http.HttpResponse;
  import org.apache.http.client.ClientProtocolException;
  import org.apache.http.client.methods.HttpRequestBase;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.params.BasicHttpParams;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.UnsupportedEncodingException;
  
  public class HttpUtil {
  
      public String getHttpResponse(HttpRequestBase request) {
          String result = null;
          try {
  
              DefaultHttpClient httpClient = new DefaultHttpClient(new BasicHttpParams());
              HttpResponse httpResponse = httpClient.execute(request);
              int statusCode = httpResponse.getStatusLine().getStatusCode();
              String reason = httpResponse.getStatusLine().getReasonPhrase();
              StringBuilder sb = new StringBuilder();
              if (statusCode == 200) {
                  HttpEntity entity = httpResponse.getEntity();
                  InputStream inputStream = entity.getContent();
                  BufferedReader bReader = new BufferedReader(
                          new InputStreamReader(inputStream, "UTF-8"), 8);
                  String line = null;
                  while ((line = bReader.readLine()) != null) {
                      sb.append(line);
                  }
              } else {
                  sb.append(reason);
              }
              result = sb.toString();
          } catch (UnsupportedEncodingException ex) {
          } catch (ClientProtocolException ex1) {
          } catch (IOException ex2) {
          }
          return result;
      }
  }
  </code></pre>