• Post Reply Bookmark Topic Watch Topic
  • New Topic

default package access  RSS feed

 
sathi jogi
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// Note: there is no package name, so this class belongs to default package/project

public class Test

{

private Test()

{

System.out.println(� I�m in private constructor�)

}

protected Test(int i){

System.out.println(� I�m in protected constructor�)

}


Test(int i, int j){

System.out.println(� I�m in default constructor�)

}



public Test(int I, int j, int k)

{

System.out.println(� I�m in public constructor�)

}

}



Package mytest;

public class Test1 extends Test

{

public Test1()

{

Test publicTest = Test(10, 20, 30);

Test protectedTest = Test(10, 20);

Test defaultTest = Test(10);
}
}

Why it is not allowed extend a class which is defined in default package/project from the class which is in mytest package ?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question. Moving...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!