wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes How to access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to access" Watch "How to access" New topic
Author

How to access

Niyas Ahmed Sheikh
Ranch Hand

Joined: Jun 15, 2005
Posts: 129
Hi,

Suppose I want to access the class A's method and variables(ofcourse public) from another class B, in which class B doesn't extend the class A.

Simply I want to access the class A, and to create the instances of class A in the class B, without class B extending class A.

For that what are the criteria or rules for it. I think we can do it in package and if so, some example codings will be very helpful.
Mahesh x Bogadi
Ranch Hand

Joined: Jul 06, 2004
Posts: 51
____________________
package a;
public class A
{
public String x;
}
______________________
package b;
import a.A;

public class B
{
private A a;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access
 
Similar Threads
Using Assertion
access to another classs' elements(variables)?
dynamic access of interface members
interesting question
Access a class no package