This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i made a class MyClass ,put it in 1 package. Using it in another class Test1 ,in another package. like MyClass m=new MyClass(); its giving error , ,MyClass is not public ,cant be access inotsside package. I made MyClass public and even its constructr public ,which as not reqd. what cud be the reason
I am assuming that you have created MyClass's instance in Test1 class. As long as MyClass has default access modifier & both classes are in different packages, you can't access MyClass from Test1. If you are not clear please post the exact code so that someone can reply you properly.
Lucky J Verma
Joined: Apr 11, 2007
MyClass is a public class,so must be accessible to any class. I tried with its Constructor with public ..even.
MyClass ,Test1 Both are in different packages/ Test1 Class is using it ,MyClass ,but not accessible.
It cant be some older version prblem as MyClass was public for start only.