Tuesday, July 5, 2011

How to Read Only Integer Value In Java ??

/*
* Author : RK
*/

import java.util.Scanner;

class ReadIntegerValue{

public static void main(String rk[]){

int rollNo=0;
Scanner scan=new Scanner(System.in);

try{

System.out.print(" Input your Roll Nubmer : ");
rollNo=scan.nextInt();
System.out.print(" Your RollNo : "+rollNo);

}catch(Exception ex){

System.out.println(" EXCEPTION :"+ex);
}

}
}

No comments:

Post a Comment