-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ_TakingInput.java
More file actions
42 lines (36 loc) · 1.41 KB
/
J_TakingInput.java
File metadata and controls
42 lines (36 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//Importing Scanner class form java.util.Scanner
import java.util.Scanner;
public class J_TakingInput {
public static void main(String[] args) {
J_TakingInput.createContactUsForm();
// Creating Object of scanner class
Scanner sc = new Scanner(System.in);
// Creating instance of Scanner class sc
System.out.println("Enter First number");
int a = sc.nextInt();
System.out.println("Enter Second number");
int b = sc.nextInt();
int sum = a + b ;
System.out.println("Sum of both number is " +sum);
}
public static void createContactUsForm(){
System.out.println("Welcome to our website");
Scanner sc = new Scanner(System.in);
System.out.println("Enter your Name");
String name = sc.nextLine();
System.out.println("Enter your State");
String state = sc.nextLine();
System.out.println("Enter your e-mail Id");
String email = sc.next();
System.out.println("Enter your age");
int age = sc.nextInt();
System.out.println("Enter your Phone Number");
long phoneNo = sc.nextLong();
System.out.println("Details Entered by you are as follows");
System.out.println("Name = " + name);
System.out.println("State = " + state);
System.out.println("E-mail Id = " + email);
System.out.println("Age = " + age);
System.out.println("Phone Number = " + phoneNo);
}
}