/*
RULE: if not declared a with public or protected, it treated as default class. a default class can access with in the package of the child classes but not out side of the package.
*/
package com.default.pack;
class Default_Class
{
}
package com.default.pack;
import com.default.pack;
class Default_Class_Use
{
Default_Class dc=new Default_Class();
}
//
package com.other.pack;
import com.default.pack;
class Default_Class_Use
{
Default_Class dc=new Default_Class(); //compile time error
}
RULE: if not declared a with public or protected, it treated as default class. a default class can access with in the package of the child classes but not out side of the package.
*/
package com.default.pack;
class Default_Class
{
}
package com.default.pack;
import com.default.pack;
class Default_Class_Use
{
Default_Class dc=new Default_Class();
}
//
package com.other.pack;
import com.default.pack;
class Default_Class_Use
{
Default_Class dc=new Default_Class(); //compile time error
}