samedi 16 mai 2020

How can i get the value of this reference? [duplicate]

I am a newbie in Java. I made a simple calculator watching a youtube video. I understood everything that the teller said. But I wanted to add a new button. I would like to produce random numbers. But when I click on it I get "java.util.Random@2ee1fb8d" value. As far as I know, this is the address in RAM that handles the value of the method. How can I get the value of this address? Thank you very much.

My code is that:

randomSayi.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
        Random rn = new Random(100);
        textField1.setText(String.valueOf(rn));


        }
    });



Aucun commentaire:

Enregistrer un commentaire