Variable Declaration and Initialization in Java

Problem:- Variable declaration and initialization in java. How to initialize and declare variables in Java or declaration of variables in java or variable initialization in java. Please read all rules for Variable Declaration and Initialization carefully cause Java is a case-sensitive language so one mistake can be the cause of hundreds of error.

Rule for Variable Declaration And Initialization

1. Import All Necessary Header File Or Library Or Package What Ever You Called them.

2. Class Name Should Contain Only Alphabet ( Upper & Lower Case ) Or _ ( Underscore )

3. Class Name And Java Program Name Should Be Shame Name Ex: Class hello And When You Save The Program It Should Be hello.java

4. Use Best Editor For Write A Java Program Instead Of NOTEPAD You Can Use NOTEPAD++ or SUBLIME TEXT

5. If You Need Any Help Our Expert Always With You Here Your Java Expert Is Prashant Chaturvedi Sir.

Variable Declaration and Initialization

data type variable name;

variable name=value;

int empid;!



output 112233

Variable Declaration and Initialization in Java

class Program1
 public static void main(String[] args)
 System.out.println("Program Started"); // Variable Declaration
 int empid;
 double empsalary;
 char empgrade; // Variable Initlization

 System.out.println("Employee ID is "+empid);
 System.out.println("Employee Salary is "+empsalary);
 System.out.println("Employee ID is "+empgrade);
 System.out.println("Program Ended");


Variable Declaration and Initialization in Java

You May Also See


2. Java Program To Find Area And Circumference Of Circle

3. Java Program To Print ASCII Value Of Character

4. Java Program To Find Area Of Triangle

5. Java Program to Convert a person's name in Abbreviated
Prashant Chaturvedi

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment