Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default Access Specifier

 
Senthamizh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, May i know the default Access Specifier in JAVA.
In Java 2 : The Complete Reference,FOURTH EDITION They mentioned in one example, a variable public by default. Is it correct?.
In that book, kindly see the page,
Page No: 192,
Topic: Member Access and Inheritence
In class A {
int i; //public by default
..................................................
if it is correct means, i want explanation, please......
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If no specifier is actually included in class/method/variable declaration, it defaults to "package", which makes accesibility open to members in the same package, if a package is specified, or members in the same directory, if there is no package statement included.
------------------
Bosun
SCJP for the Java� 2 Platform
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic