Program to demonstrate default values for fields in Java
Output of the program :
public class Light {
  static int counter;
  static int counter2 = 100;
    
  int watts;
  int watts2 = 100;
  boolean indicator;
  String location;
  public static void main(String[] args) {
      
     Light light = new Light();
  
     System.out.println("static variable counter : "
                                     + Light.counter);
     System.out.println("static variable counter2 : "
                                     + Light.counter2);
     System.out.println("instance variable watts : "
                                     + light.watts);
     System.out.println("instance variable watts2 : "
                                     + light.watts2);
     System.out.println("instance variable indicator : "
                                     + light.indicator );
     System.out.println("instance variable location : "
                                     + light.location);
  }
}
Output of the program :
 

 
