Java/ J2EE, Oracle Adf Blog
Thursday, 12 February 2015
Private Access Specifier
class
A{
private
int
data=
40
;
private
void
msg(){System.out.println(
"Hello java"
);}
}
public
class
Simple{
public
static
void
main(String args[]){
A obj=
new
A();
System.out.println(obj.data);
//Compile Time Error
obj.msg();
//Compile Time Error
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment