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.