Java Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); System.out.println("Enter your rollno"); int rollno = scanner.nextInt(); System.out.println("Enter your name"); String name = scanner.next(); System.out.println("Enter your fee"); double fee = scanner.nextDouble(); System.out.println("Rollno:" + rollno + " name:" + name + " fee:" + fee); scanner.close(); } } |
Output:
1 2 3 4 5 6 7 8 9 | Enter your rollno 33 Enter your name Paul Enter your fee 10000 Rollno:33 name:Paul fee:10000.0 |
Java Scanner class which reads the int, string and double value as an input.