Variable in Java in Hindi - Java Variable in Hindi इस Article में हम Java Variable को पूरी तरह से जानेगे। Variable हर Programing में काफी Important part होता है। ये एक प्रकार का Container होता है। जिसमे Data को भरा जाता है। सभी Programing Language में Variable को Create करने का Syntax थोड़ा बदला होता है। लेकिन Variable का use एक ही होता है। और इसके Rules भी वही होते है। अब Variable in Java in Hindi को अच्छे से जानते है।
Variable in Java in Hindi
Variable एक Memory Location का नाम होता है। जो Data Store करता है। ये एक प्रकार से Container होता है जो Value को information के रूप में Store करता है। इसे Program Execution के समय कभी भी बदला जा सकता है। एक Variable Data Type के साथ में Assign होता है। इसमें String, Float, Integer, Char, आदि Data Type की Value को Store कर सकते है।
Syntax of Variable in Java in Hindi
type variablename = value;
Creating Variable in Java in Hindi
1 2 3 4 5 6 7 8 | public class Smartblogskill { public static void main(String[] args) { String name = "vishal"; int age = 18; System.out.println("My name is:"+name + "and age is:" +age); } } |
My name is:vishaland age is:18
Java Variable Example - 2
public class Smartblogskill { public static void main(String[] args) { int x = 20; int y = 22; System.out.println(x + y); System.out.println(x - y); System.out.println(x * y); System.out.println(x == y); System.out.println(x % y); } }
42 -2 440 false 20
Java Variable Example - 3
public class Smartblogskill { public static void main(String[] args) { int x = 20; int y = 22; int z = x+y; int s = x-y; System.out.println(z); System.out.println(s); } }
42 -2
Java Identifier
Variable Name Creating Rules
Types of Variable in Hindi
1. Local Variable
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public class StudentDetails { public void StudentAge() { // local variable age int age = 5; System.out.println("Student age is : " + age); } public static void main(String args[]) { StudentDetails obj = new StudentDetails(); obj.StudentAge(); } } |
Student age is : 5
2. Instance Variable
public class Sample{ int age = 5; //Instance Variable void display(){ System.out.println("Your Age : " + age); } public static void main(String arg[]){ Sample s = new Sample(); s.display(); } }
Your Age : 5
3. Static Variable
public class Sample{ static int age = 5; //Static Variable void display(){ System.out.println("Your Age : " + age); } public static void main(String arg[]){ Sample s = new Sample(); s.display(); } }
Your Age : 5