Skip to content

Instantly share code, notes, and snippets.

@PramodDutta
Created October 17, 2024 00:25
Show Gist options
  • Save PramodDutta/23d37821e8f1dcfd5d2fff8f7fca5ef7 to your computer and use it in GitHub Desktop.
Save PramodDutta/23d37821e8f1dcfd5d2fff8f7fca5ef7 to your computer and use it in GitHub Desktop.
Task 1
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