Original Post
I recently worked in C++ and i have no idea how to perform this operation in Java. Basically i want to achieve C/C++ like global variable. Situation: I have a class (i.e. Error Loging To File Class) In main.java: ... ErrorLog log = new ErrorLog("mylogfile.log"); ... how do i pass whole "log" variable/class to other clasess i.e. renderer, filesystem, network. i dont want to create new "ErrorLog log = new ErrorLog("mylogfile.log");" at every of those clasess. i want to achieve this like effect: rendere.java ... log.add("abc"); ... Is there any good solution besides special function in any of new classes (something like this): public void passErrorLog(ErrorLog pLog){ log = pLog; } p.s. I had no idea what keywords should i use to search about this topic on google.