File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Default Access Specifier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Default Access Specifier " Watch "Default Access Specifier " New topic

Default Access Specifier


Joined: Nov 16, 2001
Posts: 18
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

Joined: Nov 06, 2000
Posts: 1510
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.
SCJP for the Java� 2 Platform

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: Default Access Specifier
It's not a secret anymore!