Home » Java programs » Most popular & searches Java programs

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





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.