How to use scanner in java?



How to use scanner in java?..

Answer / hrindows@gmail.com

import java.util.Scanner;

class classname{
public methodname(){
//Scanner declaration
Scanner s_name = new Scanner(System.in);
//Use Scanner to take input
int val = s_name.nextInt();
}
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is udp in java?

0 Answers  


What is the mapping mechanism used by java to identify IDL language?

0 Answers  


What is collection sort in java?

0 Answers  


what is difference between Exception and Error?

36 Answers  


Can we declare a static variable inside a method?

0 Answers  






What is meant by attribute?

0 Answers  


Linked List reverese program

2 Answers   Bally Technologies,


What are virtual methods?

1 Answers   TCS,


How do you create an array in java?

0 Answers  


What is meant by flickering?

0 Answers  


Hi, This is ravi i have a question like this i have string "UNDERSTAND" now i want to count the letters how many times it occures.i.e from the above string the out put should be like this U-1,N-2,D-2,E-1,R-1,S-1,T-1,A-1. how can i achieve this Thnaks in advance for your response ..

7 Answers  


What are the advantages of java?

0 Answers  


Categories