package org.kodejava.awt;
import java.awt.*;
public class ScreenSizeExample {
public static void main(String[] args) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
System.out.println("Screen Width: " + screenSize.getWidth());
System.out.println("Screen Height: " + screenSize.getHeight());
}
}
The output of the code snippet above:
Screen Width: 2560.0
Screen Height: 1080.0
Latest posts by Wayan (see all)
- How do I create a string of repeated characters? - September 1, 2023
- How do I convert datetime string with optional part to a date object? - August 28, 2023
- How do I split large excel file into multiple smaller files? - April 15, 2023