fastinput and output in java using Bufferreader class
package com.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Employeeupdate{
String name;
int id;
int age;
Employeeupdate(String name, int age, int id){
this.name=name;
this.age=age;
this.id=id;
}
public void displayDetails(){
System.out.println("Name: "+this.name);
System.out.println("Age: " + this.age);
System.out.println("Id: "+this.id);
}
}
public class update {
public static void main(String[] args)throws IOException {
BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter your name:");
String name=sc.readLine();
System.out.println("Enter your age:");
int age=Integer.parseInt(sc.readLine());
System.out.println("Enter your Id");
int id=Integer.parseInt(sc.readLine());
Employeeupdate std=new Employeeupdate(name,age, id);
std.displayDetails();
}
}
Comments
Post a Comment