Lesson 3 of 34

Scanner తో Input చదవడం

8 min 20 XP

యూజర్ నుండి values ను Scanner తో చదువుతాం. ముందుగా పైన import java.util.Scanner; రాయండి. Run నొక్కే ముందు values ను Input box లో టైప్ చేయండి.

Example: edit me and press Run

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

nextInt() పూర్ణ సంఖ్యను, nextDouble() దశాంశాన్ని, next() ఒక పదాన్ని (space వరకు), nextLine() మొత్తం లైన్‌ను చదువుతాయి. Spaces లేదా కొత్త లైన్లతో వేరైన values ఒక్కొక్కటిగా చదవబడతాయి.

Example: edit me and press Run

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

"Sum = " + a + b అని రాస్తే 1230 ప్రింట్ అవుతుంది! సంఖ్యలు ముందుగా కూడబడేలా (a + b) ను brackets లో ఉంచండి.

Challenge

+20 XP

రెండు పూర్ణ సంఖ్యలను చదివి వాటి గుణకారాన్ని print చేయండి. Input: 6 7 → Output: 42

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