Simple stack implementation using Java