java - is it a good practice to declare static variables globally as null? -


i'm confused , trying figure out if idea

  • to have static variables declared null globally in class can accessed other classes?
  • can affect performance of application whole either in way or bad way?

to have static variables declared null globally in class can accessed other classes?

when thinking it's appropriate initialize null global variable? can declare point something, use static block, or create singleton-like method initialize reference on first use. that's it.

google thinks global static variables bad idea. should have them @ all? maybe should think instead of when initialize them.

can affect performance of application whole either in way or bad way?

it's unlikely matter, unless initialization takes long requirements. should never assume 1 way or other know affect performance. write code , profile under meaningful conditions know what's important.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -