Click here to watch in Youtube :
https://www.youtube.com/watch?v=2eCPzJb5I6c&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java IO (Scanner class) |
Java Tutorial : Java IO (Scanner class) |
Java Tutorial : Java IO (Scanner class) |
Java Tutorial : Java IO (Scanner class) |
Java Tutorial : Java IO (Scanner class) |
Java Tutorial : Java IO (Scanner class) |
Java Tutorial : Java IO (Scanner class) |
Java Tutorial : Java IO (Scanner class) |
import java.util.Scanner; /* * Java Scanner class which reads the int, * string and double value as an input: */ public class ScannerDemo { public static void main(String[] args) { Scanner scanner = null; try { scanner = new Scanner(System.in); System.out.print("Enter your Id: "); int rollno = scanner.nextInt(); System.out.print("Enter your Name: "); String name = scanner.next(); System.out.print("Enter your Weight: "); double weight = scanner.nextDouble(); System.out.println("Id:" + rollno + ", Name:" + name + ", Weight:" + weight); } finally { if (scanner != null) { scanner.close(); } } } }Output
Enter your Id: 54 Enter your Name: peter Enter your Weight: 67.89 Id:54, Name:peter, Weight:67.89Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/util/Scanner.html
https://sites.google.com/site/ramj2eev1/home/javabasics/JavaIODemo_Scanner_Intro_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/JavaIODemo_Scanner_Intro_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/ebaa49adbc935437412c3f95a1070f272f5231dd/BasicJava/JavaIODemo_Scanner_Intro_App/?at=master
See also:
No comments:
Post a Comment