Jayant Varshney
Jayant Varshney

Reputation: 1825

Performance Difference

Suppose I write a code like this

if(i==100)

{
    System.out.println("hello");
} 

or I write a code like this

if(i==100) System.out.println("hello");

Will there be any difference in the performance and efficiency of above two codes?

Upvotes: 0

Views: 57

Answers (1)

Silmarillium
Silmarillium

Reputation: 149

There will be no difference in performance, only readability is less if you leave the brackets out. Also because you need to know that only the first line after your condition will be executed.

Upvotes: 3

Related Questions