View Single Post
Old 22-02-08, 01:05 PM   #3 (permalink)
bharathi chowdary
Junior Member
 
Join Date: Feb 2008
Posts: 25
Thanks: 3
Thanked 2 Times in 2 Posts
Thanks: 3
Thanked 2 Times in 2 Posts
Rep Power: 1 bharathi chowdary will become famous soon enough
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?
bharathi chowdary is offline   Reply With Quote