Skip to content

Instantly share code, notes, and snippets.

@nasrabadiAM
Created February 13, 2018 16:19
Show Gist options
  • Save nasrabadiAM/f95d7814e6017ec9f8388b96b8c634a3 to your computer and use it in GitHub Desktop.
Save nasrabadiAM/f95d7814e6017ec9f8388b96b8c634a3 to your computer and use it in GitHub Desktop.

what static keyword do in java and how to use it

static classes

you can not define static classes as general but subclasses can be static as a class member.

static methods

you can access static methods without any object and only with class reference.

static methods can not be overriden.

static variables

you can access static variables without any object creation and only with class reference. static variables allocate static memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment