Lesson 8 of 34

&&, || మరియు !: Conditions ను కలపడం

8 min 25 XP

&& (AND) రెండు వైపులా true అయినప్పుడే true. || (OR) ఏదో ఒక వైపు true అయితే true. ! (NOT) true ను false గా, false ను true గా మారుస్తుంది.

Example: edit me and press Run

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

చిన్న if/else ను ternary operator తో ఒకే లైన్‌లో రాయవచ్చు: condition ? value1 : value2

Example: edit me and press Run

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

Challenge

+25 XP

ఒక సంవత్సరాన్ని చదవండి. Leap year అయితే "Leap year", లేకపోతే "Not a leap year" print చేయండి. నియమం: 400 తో భాగించబడాలి, లేదా 4 తో భాగించబడి 100 తో భాగించబడకూడదు.

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