How can is initialize all variables in a Java class at once to zero -


i have java code class variables , rather set them particular value, i'd initialize zero. in c/c++, can memset() on size of structure, how do same thing in java?

primitives default zero. objects default null. see https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html. however, article mentions, relying on default value in java considered bad practice. better practice set them either when declare them or in constructor.


Comments

Popular posts from this blog

javascript - ScrollTo Effect (href to div) -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -