Check out example codes for "java get screen size". It will help you in understanding the concepts better.

Code Example 1

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

// the screen height
screenSize.getHeight();

// the screen width
screenSize.getWidth();

Learn ReactJs, React Native from akashmittal.com