Answers for "how to make this keyword static method in java"

1

static keyword in java

// example on static block in java.
public class StaticBlockExample
{
   // static variable
   static int a = 10;
   static int b;
   // static block
   static
   {
      System.out.println("Static block called.");
      b = a * 5;
   }
   public static void main(String[] args)
   {
      System.out.println("In main method");
      System.out.println("Value of a : " + a);
      System.out.println("Value of b : " + b);
   }
}
Posted by: Guest on November-21-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language