Java Language Using the static keyword

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • public static int myVariable; //Declaring a static variable
  • public static myMethod() { } //Declaring a static method
  • public static final double MY_CONSTANT; //Declaring a constant variable that is shared among all instances of the class
  • public final double MY_CONSTANT; // Declaring a constant variable specific to this instance of the class (best used in a constructor that generates a different constant for each instance)


Got any Java Language Question?