|
Re: about access specifier
hai kiran,
i have understood what you said.So the default access specifier of a class is default.see the below prg......
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();
}
}
Here the "Main"class is able to acess the variable "a" and the function "print()" which are the default members of Demo class which explains to be as the classes "Demo" and "Main" belongs to the same package. Does the classes "Demo" and "Main" really belongs to the same package.If so,which package it is? and how?
|