John Delmark Aguilar

Delmark - Profiling
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Scanner Syntax

View previous topic View next topic Go down 
AuthorMessage
dElmARk
Admin
Admin
avatar

Posts : 92
Join date : 09/04/2012

PostSubject: Scanner Syntax   Tue Oct 23, 2012 2:04 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 Question Question

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();
    }
}
Back to top Go down
View user profile http://delmark.meabout.com
 
Scanner Syntax
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
John Delmark Aguilar :: dElmARk Productions :: Java Programs :: Tutorials-
Jump to: