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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -