I
I
IvanN7772020-06-02 10:39:27
Java
IvanN777, 2020-06-02 10:39:27

Is it correct to create a reference variable in the loop or before the loop?

One of my friends said

It is desirable to declare the object in the smallest possible area.
There is no performance improvement by declaring and creating objects outside of the loop, even if in each loop the object is restored.

But is it?

Never thought before

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-06-02
@IvanN777

So.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question