import java.awt.Dimension;
import java.awt.Toolkit;
public class ScreenResolution {
public static void main(String[] args)
{
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); //get the dimension of screen
System.out.println("Screen Widht: " + screenSize.getWidth());
System.out.println("Screen Height: " + screenSize.getHeight());
int screenResolution = Toolkit.getDefaultToolkit().getScreenResolution(); //get the resolution
System.out.println("Screen resolution is : "+screenResolution);
}
}
Output-
Screen Widht: 1366.0
Screen Height: 768.0
Screen resolution is : 96
import java.awt.Toolkit;
public class ScreenResolution {
public static void main(String[] args)
{
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); //get the dimension of screen
System.out.println("Screen Widht: " + screenSize.getWidth());
System.out.println("Screen Height: " + screenSize.getHeight());
int screenResolution = Toolkit.getDefaultToolkit().getScreenResolution(); //get the resolution
System.out.println("Screen resolution is : "+screenResolution);
}
}
Output-
Screen Widht: 1366.0
Screen Height: 768.0
Screen resolution is : 96
No comments:
Post a Comment