Hello,
I would like to ask if is possible to use an object that created in main method to the constructor of a class. Or if there is way to do that, to share the same object main method and constructor.
Thank you
1 reply to this topic
#1
Posted 06 November 2011 - 05:47 AM
"Programming is like sex. One mistake and you have to support it for the rest of your life."
-Michael Sinz|
|
|
#2
Posted 06 November 2011 - 08:58 AM
Something like:
Class A {
public A() { ... }
}
class B {
public B(A a){...}
}
class Driver{
public static void main(String[] args) {
A a = new A();
B b = new B(a);
}
}
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









