In one class i have a back button(java Swing)...i want when i click this button it will go to another class and close the current class...however, when i use System.exit(0)...it closes both 2 class...if i use setVisible(false) for the current class...that class still running...how can i close the current and move to another class then????????...(i use JFrame)

What do you mean by "close the current class"?
Classes are never closed. Do you mean to close a JFrame window? Use window.dispose().

Have a look athe dispose() method for your closing window - it closes the window and releases its resources,

as for the System.exit(0); command you tried -> this does not close the class you're working in, it stops the JVM, so everything running in it will be shut down.

yes as everyone has mentioned you can use dispose() and you never really have to close a class once i has come to the end of all its executable code, it would have to be re-initiated to start its execution again