Variables Scope In Hindi

Java Variables Scope In Hindi

Java

Java Variables Scope In Hindi – Java Me Variables Ko Use/ Access Usi Region Ke Doraan Kiya Ja Sakta Hai, Jiske Andar Unko Declare Aur Create Kiya Gaya Hai.  Isi feature ko hum java scope kehte hain.

Java Scope/ Java Variable Scope Teen Tareeke Ka Hota Hai Jo Hum Neeche Examples Ke Saath Pdhenge Aur Samjhenge.

Java Main Data Ko Store Karne Ke Liye Variables Ka Istemal Kiya Jata Hai Or Java Variables Ek Tarah Ka Containers Hota Hain Jo Data Ko Information Ke Rup Main Store Karte Hain |

Java Variables Scope In Hindi

Java Main Data Ko Store Karne Ke Liye Variables Ka Istemal Kiya Jata Hai Or Java Variables Ek Tarah Ka Containers Hota Hain Jo Data Ko Information Ke Rup Main Store Karte Hain |

Java Variable Par Koi Bhi data type ki value store ki ja sakti hai | Example : Number , String, int , float ,Char etc |

Yadi Aapne  HTML Full Course  And CSS Full Course Nhi Read Kiya Hai To Aap Vah Bhi Read Kar Sakte Hai |

Java Mai Koi Types Ke Variables Hote Hai Jinhe Niche Ek Ek Point Mai Understand Kiya Gaya Hain |

  • String – stores text, Like “Hello”. String values Ko double quotes Duwara Close Kiya Jata Hai |
  • int – stores integers (whole numbers), without decimals, Like 123 or -123
  • float – stores floating point numbers, with decimals, Like 19.99 or -19.99
  • char – stores single characters, such as ‘a’ or ‘B’. Char values are surrounded by single quotes
  • boolean – stores values with two states: true or false

Waise Upper Diye Gaye Variables Par Ek Alag Se Article Bana Hai Jinhe Data Types Kahte Hai Aap Inhe A to Z Understand Kar Sakte Hai |

Types of Variables Scope In Java In Hindi

Variables In Java Hindi – Java Programming me variable ke 3 types Hote Hai|

  1. Class Scope
  2. Local Scope
  3. Block Scope

Inhe Ham Ek Ek Karke Niche Dekhe Wale Hai |

Java Class Scope In Hindi

Ye Variables, Class Ke Andar (Sabhi Methods/ Functions Ke Bahar) Declare Kiye Jaane Chahiye. Aisa Karne Se Unhe Class Me Kahin Bhi Use/ Access Kiya Ja Sakta Hai. For Example, Jab Hum Kisi Bhi Method Se Bahar Koi Variable Declare Krte Hain Toh Puri Class Me Aur Class Ke Har Method Ke Pass Woh Variable Uplabdh/ Accessible Hota Hai. Variables Ke Iss Prakaar Ke Scope Ko Class Scope Kehte Hain.

Example 1

public class ScopeExample {
// Accessible throughout the class
  String classVariable1;
  int classVariable2;
}

Upar Diye Gaye Example Me Humne Scopeexample Naam Ki Class Define Ki Hai Aur Isme Do Variables Declare Kiye Hain, Classvariable1 Aur Classvariable2, Jo Ki Poori Class Me Accessible Honge.

Java Local Scope In Hindi

Ye Woh Variables Hote Hain Jo Kis Bhi Class Method Ke Ander Declare Kiye Jate Hain, Aur Method Ke Andar Hone Ki Wjah Se Unka Jeevan Bhi Method Ke Andar Tak Seemit Hota Hai. Jab Tak Method Perform Karta Hai Tab Tak Ye Computer Memory Me Hote Hain Aur Uske Baad Wha Se Mitaa Diye Jaate Hain. Kisi Bhi Method Ke Bahar Unka Ko Jeevan Nahi Hota.

Example 2

public class ScopeExample {
// Accessible throughout the class
String classVariable1;		//class variable scope
  void LocalMethod() {
      // Accessible inside the method only
      String localVariable1 = "Short Timer!"; 	//local variable scope
      int localVariable2 = 123;	//local variable scope
      boolean local = false;		//local variable scope
  }
int classVariable2;	//class variable scope
}

Example 1 Me Humne Ek Method Ko Define Karke Local Variables Declare Kiye Hain Jo Ki Method Ke Andar Hi Accessible Honge.

Java Block Scope In Hindi

Block Se Humara Matlab Unn Group Of Statements Se Hai Jo {} Curly Braces Ke Beech Me Likhi Jaati Hain. Jo Variables Unn Braces Ke Beech Me Declare Kiye Jate Hain Woh Unn Braces Ke Beech Me Yaani Uss Block Me Hi Accessible Hote Hain. Block Kisi Bhi Loop Ya Phir Conditional Statements Ka Ho Sakta Hai.  Issliye Jin Variables Ke Jeevan Ka Daira Ek Block Tak Seemit Hai, Unhe Block Scope Variables Kehte Hain.

Example 3

public class ScopeExample {
// Accessible throughout the class
String classVariable1;		//class variable scope
void LocalMethod() {
	// Accessible inside the method only
	String localVariable1 = "Short Timer!"; 	//local variable scope
	int localVariable2 = 123;	//local variable scope
	boolean local = false;		//local variable scope
	for (int i = 0; i < 5; i++) {
	   // Accessible inside the block only
	   int blockVar=50;  	//block variable scope
	   System.out.println(blockVar);
       }
     }
     int classVariable2;	//class variable scope
}

Example 1 Me Humne Ek For Loop Ko Define Karke Block Variable Declare Kiye Hain Jo Ki Loop Ke Andar Hi Accessible Hoga.

Friends Mujhe Umeed Hai Ki Aapko Variables Scioe in Hindi Ke Bare Mai 100% Jankari Ho Gayi Hogi | Agar Aapko Learn Karne Main Dikkat Aa Rahi Hai To Aap Mere Se Contact Kar Sakte Hai |

Leave a Reply

Your email address will not be published. Required fields are marked *