|
Re: about access specifier
Classes Main and Demo will be in the default package.
Here the default package in the sense, its the folder where the java file will reside.
E.g. Here I placed the file in c:\demopack folder and compiled. As a result the classes will be stored in the demopack.
The scope\visibility of this classes will be in demopack.
class Demo
{
int a=5;
void print()
{
System.out.println(" a is: "+a);
}
}
class Main
{
public static void main(String args[])
{
Demo d=new Demo();
d.print();
}
}
__________________
Kiran
|