tongshen9095 / JobRecommendation

0 stars 0 forks source link

static vs non static #10

Open tongshen9095 opened 4 years ago

tongshen9095 commented 4 years ago
public class GitHubClient {
  private String s1 = "abc"

  public List<Item> search(double lat, double lon, String keyword) {
    // omit code using GitHub client to request info
    String responseBody = EntityUtils.toString(entity);
    JSONArray array = new JSONArray(responseBody);
    // can I call the method without an object
    return getItemList(array);
  }

  private static List<Item> getItemList(JSONArray array) {
    // helper function to filter the search result
  }
}
tongshen9095 commented 4 years ago

ask in stackoverflow

tongshen9095 commented 4 years ago

from piazza use static is better non-static can call without an object inside the class