The Artima Developer Community
Sponsored Link

Java Answers Forum
Is there performance issues with declaring variables inside a loop?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
jinaraj

Posts: 8
Nickname: bullet
Registered: Feb, 2002

Is there performance issues with declaring variables inside a loop? Posted: Nov 27, 2002 5:44 PM
Reply to this message Reply
Advertisement
Hi,
Is there any performance issues with declaring variables inside a loop? Please see the following examples

Eg:1

for (int i=0;i<10;i++) {
x x1 = (x) list.get(i);
}

Eg:2

x x1 = null;
for (int i=0;i<10;i++) {
x1 = (x) list.get(i);
}

What is the performance difference between these two strategies? Which one is better and why?

Topic: Urgent Artimians plz!!!! Previous Topic   Next Topic Topic: Help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use