• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call class from different package?  RSS feed

 
Syskata Mitev
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have two packages: Main and Users, so i wont from package Users to call package Main class Begin. Please sorry for my stupid question but i am beginer in the java flexibility.
 
Deroga Rivera
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could either import the other package or fully qualify your call.
so import user.begin.* and you can get to all your public methods
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Use import statements, make sure that the class is public.


Remeber a Clas Can be : Public or Defualt Package access.

If Default it can be accessed only with in same package.

If public you can access out side of package provided that the class is imported.




 
Campbell Ritchie
Marshal
Posts: 55790
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Posted by Srinivas Kalvala
Remeber a Clas Can be : Public or Defualt Package access.
You can also have private or protected class access.
 
Syskata Mitev
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot java family.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!