Lesson 2 of 34
Variables और Data Types
8 min 20 XP
Java में variable बनाते समय उसका type बताना ज़रूरी है। int पूर्ण संख्याओं के लिए, double दशमलव के लिए, boolean true/false के लिए, char एक अक्षर के लिए और String टेक्स्ट के लिए है।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.String के साथ + लगाने से values जुड़ जाती हैं (concatenation)। Variable की value बाद में बदल सकते हैं, पर उसका type नहीं। char में single quotes ' ' और String में double quotes " " लगते हैं।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.Variable को final बना दें तो वह कभी नहीं बदलेगा (constant)। Constants के नाम आमतौर पर CAPITALS में लिखे जाते हैं।