Variable Declaration And Initialization in Java

Java Programming Language / Variables in java

5979

Program:

public class VariableDeclarationAndInitialization{

   public static void main(String []args) {
     int a, b, c;                // Declares three int variable a, b, and c
     a = 10; b = 10;            // Example of initialization of variable a and b
     byte B = 22;               // initializes a byte type variable B
     double pi = 3.14159; // declares and assigns a value of PI
     char k = 'a';             // the char variable k iis initialized with value 'a'

   }
}

  

Output:

No

Explanation:

int a, b, c; // Declares three int variable a, b, and c

a = 10; b = 10; // Example of initialization of variable a and b

double pi = 3.14159; // declares and assigns a value of PI


This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.