All Java objects are dynamically allocated. You're always passing around references to them. This is how the language is designed. When you do:
ClassA obj = new ClassA();
Then the object is allocated on the heap and a reference to it is stored on the stack (assuming that's inside a method, of course). What this means is that you can always pass objects about without worrying about where they are stored.