• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference under the scene

 
Kaylee Sebi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is difference between the following two lines of code under the scene ( in JVM )?

1. Long a= new Long(28L);

2. Long b= (Long)28L


which one is more efficient ?

Thanks
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2. will compile to

Long b = Long.valueOf(28L);

The difference in efficiency will be marginal in almost any case.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!