with "Reflection" it can be done.
http://en.wikipedia.org/wiki/Reflection_%28computer_science%29
I think I guess correctly but you are the decider which is the correct one????
hik hik....
just google it and find the answer.
code for learn something
public class A {
private static A a = null;
//singleton pattern
public static A getInstance(){
if(a==null)
a = new A();
return a;
}
void m(String msg){
System.out.println(msg);
}
public static void main(String[] args) {
A a = getInstance();
A.B b = a.new B();
a.m("m from A");
b.x(a);
}
class B{
void x(A a){
A t = A.getInstance();
t.m("x from B");
System.out.println("Both of objects are the same one? "+t.equals(a));
}
}
}
Subscribe to:
Post Comments (Atom)
Let's try to build scrum masters/project managers/software architects/even a company with training AI models
The concept: The basic concept is to build trained AI model for each role separately in scalable fashion within a private cloud. As an examp...
-
Quarkus gRPC Service Implementation from the scratch Requirement In order to produce most reliable, fast and maintainable products we can us...
-
The concept: The basic concept is to build trained AI model for each role separately in scalable fashion within a private cloud. As an examp...
-
Problem Statement: Suppose the Government plans to issue up to $10,000 of Savings Bonds. Four individuals applied for a total of $18,000 of...
No comments:
Post a Comment