• Post Reply Bookmark Topic Watch Topic
  • New Topic

object creation inside method  RSS feed

 
Noble Bhaskar Aswanapally
Greenhorn
Posts: 13
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

when we create a object inside a method.

It will be created in stack or in Heap?


thanks,
Noble Bhaskar
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The object reference (the variable) will be created on the stack. The object it refers to is created in the heap though, like any other object.
 
Noble Bhaskar Aswanapally
Greenhorn
Posts: 13
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Rob thank you very much
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!