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

Hi friends, i am new to java. can you explain how java is secured.

2 Answers  


Explain about vector, dictionary,hash table, property classes?

1 Answers   Patni,


Is minecraft 1.15 out?

0 Answers  


What are different type of exceptions in java?

0 Answers  


Explain cookies?

2 Answers   Canon,






what is polymorphism with example?types of polymorphism?

15 Answers   HP, Sigma Solve,


What are the principle concepts of oops?

0 Answers  


What is core java called?

0 Answers  


how to minimize the functionality to will not force garbage collector?

2 Answers  


Name some OOPS Concepts in Java?

0 Answers  


What does system.gc() and runtime.gc() methods do?

0 Answers  


Is main a function?

0 Answers  


Categories