oop - Efficiency of java static method calling -


my professor said when ever use static method class whole class gets loaded memory , method executed.

my question is: if class contains 100 methods , 50 different variables , if called 1 static method class.the complete class(100 methods , 50 variable ) gets loaded in memory inefficient in terms of memory , performance. how java deals kind of issue ?

true, class byte-code loaded when call static method (but once, not every time).. same happens when call non-static method. in later case instance must created. thus, in sense of question, false dichotomy. because java dynamic language , platform (with jit) runtime efficiency can increase between method invocations. thus, best write clear , concise code (that write dumb code). if clearest way implement solution static methods use them.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -