Admin[dElmARk] Forum Owner
Posts : 78 EC-Points : 6304 Thanked : 21 Join date : 15/10/2011 Age : 29 Location : Philippines
Hacker's Info Hacking Exp: (0/0) Hacker Type: White Hat Hacking Title:
| Subject: Scanner Syntax Fri Nov 18, 2011 5:50 pm | |
| The program must start with this import java.util.*; Again it must be before the class name but inside the method code. What is the difference of the Scanner to BufferedReader Scanner uses less code than the BufferedReader. Code: - Code:
-
import java.util.*; Scanner scName = new Scanner(System.in); Sample Program: - Code:
-
import java.util.*; class progName{ public static void main(String[] args){ Scanner scnr = new Scanner(System.in);
String stringVar = scnr.nextLine(); int intVar = scnr.nextInt(); Double doubleVar = scnr.nextDouble(); Float floatVar = scnr.nextFloat(); } }
|
|