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.