Q:

Java program to print Screen Resolution

0

Java program to print Screen Resolution

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Print Screen Resolution: This java program will print the screen resolution.

package com.includehelp;

import java.awt.Dimension;
import java.awt.Toolkit;

/**
 * Program to print Screen Resolution
 * @author includehelp
 */
public class ScreenResolution {
    
    static String getResolution(){
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        short width  = (short)screenSize.getWidth();
        short height = (short)screenSize.getHeight();
        
        String resolution = width+" X "+height;
        return resolution;
    }
    
    public static void main(String[] args) {
        System.out.println("Screen Resolution : "+getResolution());
    }
    
}

Output

Screen Resolution : 1366 X 768

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now