Welcome to the Ranch
I would have added code tags to your post, which would have made it look better, but you had not idented the code.
The answer to your question is yes, and no.
Just because that code will compile and run (try it, when you have got rid of the spelling error in class) doesn’t mean it isn’t really poor design. I hope that is simply, “I wanted to see what happens if…” code.
Joined: Mar 07, 2013
Thanks guys. It did work but I know its a bad design. I just wanted to quickly find out if it worked. It was required in one of the method stub for a project that I'm doing. Basically its an Android project which has a number of classes and objects interacting with each other, etc. I'm new to the JavaRanch forums so pardon me
Joined: Oct 13, 2005
Still bad design. You are using that List as a global variable, which is dubious. You can make it available via get methods. Or you can provide addToList(T t) and removeFromList(T t) methods, and make the List private.