1

could anyone tell me the difference between these please?

1-)

class Example {
    int x;
    Random random;

    public Example() {
        x = 5;
        random = new Random();
    }

}

2-)

class Example {
    int x = 5;
    Random random = new Random();

    public Example() {
    }

}

Also, which one is more common/correct?

shanks
  • 342
  • 2
  • 4
  • 16

0 Answers0