Professional Documents
Culture Documents
4.identifiers and Modifiers
4.identifiers and Modifiers
Java SE
Contents
• Identifiers
• Modifiers
• Access Modifier
• စ"လu,-အeရအတ(က&အeနနCင&1 အကD&1အသတ&မEiပ=
• အစeနစ"လu,- အeန.ဖင&1 English Letter မ8"-၊ Currency Code မ8"-၊ underscore မ8"-အ"-
အသu,-.ပuDiuင&ပ=သည&
void greet() {
System.out.println( My name is + name);
System.out.println( I am + age years old );
}
}
Why we need to control
Access of members?
public class Test {
public static void main(String [] args) {
Student s = new Student();
s.name = Aung Aung ;
s.age = -10;
s.greet();
Can’t control it’s own
} state
}
Access Modifier
• Variable, Method DCင&1 Class တiuသည& Default
အတiuင&-eရ-သ"-ထ"-ပ=က ၎င&-တiuDCင&1 Package တစ&ခu
အတ(င&-တ(င& အတLတက(eရ-သ"-ထ"-eသ" Class မ8"-မC
ဆက&သ(ယ& အသu,-.ပuDiuင&ပ=သည&
void greet() {
System.out.println( My name is + name);
System.out.println( I am + age years old );
}
}
Non Access Modifiers
• abstract • synchronized
• static • volatile
• final • native
• strictfp
• transient
static modifier
• static modifier အ"- variable, method DCင&1 nested class,
nested interface တiuတ(င& အသu,-.ပuDiuင&ပ=သည&