-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMy_Work.java
52 lines (23 loc) · 1.11 KB
/
My_Work.java
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
43
44
45
46
47
48
49
50
51
52
package com.mywork;
import java.util.Scanner;
public class My_Work {
public static void main(String[] args) {// scanner is a class
Scanner s=new Scanner(System.in); //system is a final class //.in ---input stream
System.out.println("what is u r age ?");
byte nextByte = s.nextByte(); //s.next
System.out.println("my age is " + nextByte);
System.out.println("what is your id");
byte nextByte2 = s.nextByte();
System.out.println("my id is"+ nextByte2);
System.out.println("what i u r native ?");
String next = s.next();
System.out.println("my native is "+ next);
s.nextLine();// to avoid data confusion from next and nextLine declaration
System.out.println("what is ur name?"); //s.nextLine
String nextLine = s.nextLine();
System.out.println("my name "+ nextLine);
System.out.println("what is ur address?");
String nextLine2 = s.nextLine();
System.out.println("my address is " + nextLine2);
}
}