-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQB 716.java
More file actions
33 lines (27 loc) · 758 Bytes
/
QB 716.java
File metadata and controls
33 lines (27 loc) · 758 Bytes
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
//QB 716
import java.util.Scanner;
class Ex1 {
String s;
char c;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter mobile number ");
String s = sc.nextLine();
Ex1 ab = new Ex1(s);
ab.check();
}
Ex1(String s) {
this.s = s;
}
void check() {
if (s.length() == 10) {
if (s.startsWith("9") || s.startsWith("8") || s.startsWith("7")) {
System.out.println("Your number is starting with 7,8,9");
} else {
System.out.println("Your number is not starting with 7,8,9");
}
} else {
System.out.println("Invalid number");
}
}
}