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)। Constant-এর নাম সাধারণত CAPITALS-এ লেখা হয়।

Challenge

+20 XP

String variable city-তে "Erode" এবং int variable year-এ 2026 রাখুন, তারপর print করুন: City: Erode Year: 2026

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.