File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using public class in other packages

 
abhinav sood
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

now its giving thee output temp2 ,temp1,temp2
nw i want to know temp1 class is public so how we can access it in some other package
 
Callum Ludwig
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Temp1 is an inner class of Temp2, so I think it can only be accessed via the public class Temp2.

I'm not strong on inner classes as I don't really like the use of them in code, so I could be wrong.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Abhinav,
In future, while posting code, please UseCodeTags
I have added them to your original post for now. As you can see, they make the code much more easier to read and understand
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Callum Ludwig wrote:Temp1 is an inner class of Temp2, so I think it can only be accessed via the public class Temp2.

Looking at the code above, I don't see that class Temp1 is an inner class of class Temp2.
abhinav sood wrote:nw i want to know temp1 class is public so how we can access it in some other package

In your code above class Temp1 is not public. Since it's not public, it cannot be directly accessed from another package.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic