java - Is it possible for an interface to be accessible only in the same package and child packages? -


is possible interface accessible in same package , child packages?

i have defined interface default modifier:

package com.mycompany.myapp.dao;  import java.io.serializable;  interface basedao<t, id extends serializable> {     public void create(t t);         public t readbyid(id id);        public void update(t t);         public void delete(t t); } 

now have child package want define class implements basedao. wrote code:

package com.mycompany.myapp.dao.jpa;  import java.io.serializable;  public class basedaojpa<t, id extends serializable> implements basedao<t, id> { ... } 

but error:

basedao cannot resolved type

so restriction java interface or doing wrong way?

thanks

in java there no such thing "child package". don't fooled dots. com.mycompany.myapp.dao , com.mycompany.myapp.dao.jpa 2 separate packages have no relation each other.

so answer question: no, not possible make interface visible child packages. can make interface public, visible other packages.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -