Created
October 17, 2024 00:25
-
-
Save PramodDutta/23d37821e8f1dcfd5d2fff8f7fca5ef7 to your computer and use it in GitHub Desktop.
Task 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class UserInput { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
// Taking user input | |
System.out.print("Enter your name: "); | |
String name = scanner.nextLine(); | |
System.out.print("Enter your age: "); | |
int age = scanner.nextInt(); | |
System.out.print("Enter your salary: "); | |
double salary = scanner.nextDouble(); | |
// Printing the user input | |
System.out.println("Name: " + name); | |
System.out.println("Age: " + age); | |
System.out.println("Salary: " + salary); | |
scanner.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment