How to use scanner in java?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Java Annotations?

549


What is considered an anti pattern?

515


how to open and edit XML file in Weblogic???

1537


explain copyonwritearraylist and when do we use copyonwritearraylist?

530


What is r in java?

585






What is bubble sort in java?

609


What is JFC?

699


What are different types of constants?

508


What is parsing a string?

584


Difference between object instantiation and construction ?

574


What is a heavyweight component?

537


What does those terms actually mean included in the j.d.k i.6?

1591


Explain aggregation in java?

541


What is the java virtual machine?

572


What is linked hashset and its features?

539