When a method or variable is declared as
Here, book and book1 are two different packages and the package book1 comprises the class write and method test. The package book comprises the class read.
public class write
{
public void test()
{
System.out.println(”Write”);
}
}
import book1.*;
class read
{
public static void main(String args[])
{
write w= new write();
w.test();
}
}
In this example, read and write both are from different packages. However, read can invoke the method test() in write class because both are marked as
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
