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.
1. HOW TO PRINT DIFFERENT VALUE IN JAVA
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
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.
data type variable name;
variable name=value;
int empid;!
empid=112233
System.out.println(empid);
output 112233
Output:-
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;!
empid=112233
System.out.println(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 empid=123456; empsalary=50000.25; empgrade='z'; 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"); } }
Output:-
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
0 Comments: