I made a lot of static methods. Inside the static method, you need to call the getClass() method as shown below
public static void startMusic() {
URL songPath = getClass().getClassLoader().getResource("background.midi");
}
But if you compile it like this, Eclipse
Cannot make a static reference to the non-static method getClass()
from the type Object
Is there any way to call this error?
java static-methods
Instead of the getClass method,
class name.class
You can write that.
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
578 Understanding How to Configure Google API Key
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.