-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccessModifiers.java
More file actions
29 lines (23 loc) · 929 Bytes
/
Copy pathAccessModifiers.java
File metadata and controls
29 lines (23 loc) · 929 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
class Ms {
private void dev() { // only available to the class Microsoft
System.out.println("Visual studio 2022 new preview has been released.");
}
public void xbox() {
System.out.println("Xbox series X and S has been launched");
}
protected void security() { // cn be acced within same package or in the subclasses of same package
System.out.println("windows defender ATP service version: ");
}
void azure() { // when no access specifier is mentioned it is default specifier.
System.out.println("The main business of microsoft is MS Azure Cloud");
}
}
public class AccessModifiers {
public static void main(String[] args) {
Ms microsoft = new Ms();
//microsoft.dev(); //not possible here because dev() function has private access specifier on it.
microsoft.xbox();
microsoft.security();
microsoft.azure();
}
}