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 ആണ് print ആവുക! സംഖ്യകൾ ആദ്യം കൂട്ടാൻ (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.