V
V
voproser456542022-04-14 21:59:19
Java
voproser45654, 2022-04-14 21:59:19

Is it okay to code like this?

There is a code

import javax.swing.JFrame;
import java.awt.Color;

class Main extends JFrame {

  public static void main(String[] args) {
    JFrame app = new JFrame();
    app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    app.setSize(640, 480);
    app.setLocationRelativeTo(null);
    app.getContentPane().setBackground(Color.black);
    app.setVisible(true);
  }
}

But as for me, it would be better to write
import javax.swing.JFrame;
import java.awt.Color;

class Main extends JFrame {

  public static void main(String[] args) {
    JFrame app = new JFrame();
    app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    app.setSize(640, 480); app.setLocationRelativeTo(null);
    app.getContentPane().setBackground(Color.black);
    app.setVisible(true);
  }
}

Wouldn't that be bad manners?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2022-04-14
@voproser45654

This would be bad manners.

T
TheAndrey7, 2022-04-14
@TheAndrey7

Found 0 differences.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question