Pages

Sunday, 20 November 2016

Problem 42 - Contoh Scanner console

  1. import java.util.Scanner;  
  2. class ScannerTest{  
  3.  public static void main(String args[]){  
  4.    Scanner sc=new Scanner(System.in);  
  5.      
  6.    System.out.println("Enter your rollno");  
  7.    int rollno=sc.nextInt();  
  8.    System.out.println("Enter your name");  
  9.    String name=sc.next();  
  10.    System.out.println("Enter your fee");  
  11.    double fee=sc.nextDouble();  
  12.    System.out.println("Rollno:"+rollno+" name:"+name+" fee:"+fee);  
  13.    sc.close();  
  14.  }  
  15. }   


0 comments:

Post a Comment