My Stack implementation in Java
T extends Serializable


Why? There doesn't seem to be a good reason to do this.



throw new Exception("MyStack is Full, need to pop");


Your professor probably told you to do it like this, but it'd at the very least be an interesting exercise to see if you can resize the array to hold more, rather than letting it be full. It's not terribly difficult, either.



@SuppressWarnings("unchecked")


These are almost always unnecessary; you theoretically should be able to rewrite your code such that they're unnecessary.

However, if I'm remembering my Java correctly, that's not possible in this case, so it's better to eliminate the warning, so that the "real" ones are more visible.



this.myArray[this.arraySize++]


This code, though its behavior is well-defined, is not what you should be writing. Split it into two lines. The two statements -- the set and the increment -- already connected by being very nearly the sole contents of a method. Putting the increment in the brackets just makes it more likely that the increment won't be seen. I, for one, didn't see it until I took a closer look, because it appeared to be incorrect.

You don't get an award for fewer lines. Every second you don't need to spend re-reading your code later is a second you can use to implement new, cool features, and every second people reading your code don't spend on unclear syntax is a second they can use to find real bugs.



It's unfortunate that you can't remove the Class&lt;T&gt; passed in to the constructor, but that's the way it is, so good job for minimizing its impact.



Space and indent things consistently. This:

new MyStack&lt;Integer&gt;(Integer.class, 3);


is not consistent with this:

Array.newInstance(c , stackSize);




Now, your response to any of these could be "meh, it's a project for school, so I don't really care about that", to which my response is this:

School is supposed to teach you how to code well, in part by drilling how to do that into your head through practice. If you don't practice writing code well, you'll find yourself stuck in habits of writing code that works, but nobody can read after three months. If you practice writing code well -- as in, readable, clean code, not necessarily bug-free -- starting as soon as possible, you'll save yourself a lot of headache debugging later.