Lesson 3 of 34

Scanner மூலம் Input பெறுதல்

8 min 20 XP

User-இடமிருந்து மதிப்புகளைப் பெற Scanner பயன்படுத்துகிறோம். முதலில் import java.util.Scanner; என்று எழுத வேண்டும். Run செய்வதற்கு முன் Input box-ல் மதிப்புகளை type செய்யுங்கள்.

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() முழு வரியையும் படிக்கும். Space அல்லது புதிய வரியால் பிரிக்கப்பட்ட மதிப்புகளை ஒவ்வொன்றாகப் படிக்கலாம்.

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) என்று bracket போடுங்கள்.

Challenge

+20 XP

இரண்டு முழு எண்களைப் படித்து அவற்றின் பெருக்கல் தொகையை (product) print செய்யுங்கள். Input: 6 7 → Output: 42

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