Efficiency of Java code with primitive types
- by super89
Hello!
I want to ask which piece of code is more efficient in Java?
Code 1:
void f()
{
for(int i = 0 ; i < 99999;i++)
{
for(int j = 0 ; j < 99999;j++)
{
//Some operations
}
}
}
Code 2:
void f()
{
int i,j;
for(i = 0 ; i < 99999;i++)
{
for(j = 0 ; j < 99999;j++)
{
//Some operations
}
}
}
My teacher said that second is better, but I can't agree that opinion.