Skip to content

Instantly share code, notes, and snippets.

@athiththan11
Last active February 14, 2019 08:17
Show Gist options
  • Save athiththan11/cd0f3aa9c782fee37ed78f42871b1a2e to your computer and use it in GitHub Desktop.
Save athiththan11/cd0f3aa9c782fee37ed78f42871b1a2e to your computer and use it in GitHub Desktop.
`static` keyword usage on fields
public class SmartPhone {
private String modelNumber;
private String battery;
public static int numberOfObjects;
public SmartPhone (String modelNumber, String battery) {
this.modelNumber = modelNumber;
this.battery = battery;
numberOfObjects++;
}
// getters and setters
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment