Java program to print Screen Resolution

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

Java Most Popular & Searched Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.