I'm not a total noob to programming. I've coded in one language or another for 20 years. Just not in Java. My main language is Objective C on iOS and OS X.
I'm developing a java app and I'm trying to implement the MVC pattern that iOS enforces. i.e. my UI, data model are separate classes and a third class, a controller is the 'glue'.
What I'm trying to do is super easy in objective c, and I've searched google all night trying to find the equivalent pattern in java.
For example I have two classes. Class A and Class B. Class A implements main(). main instantiates Class B. I need Class B to be able to call instance of Class A's methods. I'n Objective-C Class B would have a pointer to Class A as an invar. So when Class A instantiates Class B, it sets said pointer to itself, so Class B now has a reference to Class A and can call its public methods.
But it seems I can't do this from Class A where it insatiaties Class B (in Class A main(). Netbeans complains about not being able to access a non static variable from a static method to something like that. It seemed main() needed to be static.
I'm thinking maybe I could add another class analogue to the AppDeleagte in Cocoa. So I'd have a main() in some other class and it would instantiate the MVC.
I don't get this apparent restriction about static. The only time i encountered it was with a local that needed to retain its value through successive method calls.
I never declared a method static, nor encountered any problems accessing any vars that would normally be in scope.
This seems so simple I feel I'm missing something obvious.
PS I'm using NetBeans 7.01 and I'm just diving into Java on my own. I've tried getting help Yahoo chat rooms, and from a friend on fb, but he had to run.
I appreciate any help anyone gives on this.
Thanks for reading this ramble, and have a good night.