Is It Possible to Connect Two Different Jframe to One Single Class?

I make two forms but I have this problem where my second form that will appear after we press a button on the first form could not get the data from the subclass. The plan was I want to only use one single class.

So first form is an input, we input data and it’ll be put into the subclass A. Then the second form will go get the input from the subclass A. The best I could do is to use getText() but I want to make my program object oriented WITHOUT database or sql. The thing I use is apache netbeans.

private void bCetakActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
        output.lbNim.setText(kls.getNim());
        output.lbKode.setText(tKode.getText());
        output.lbJudul.setText(tJudul.getText());
        output.lbPinjam.setText(tTgl.getText());
        
        this.setVisible(false);
        output.show();
    }

// the kls is subclass and getNim() is a function in kls. I want it to be like that, not getText()