Skip to main content
3 of 6
added 102 characters in body
F. George
  • 347
  • 1
  • 10

Kotlin + Jline 2, 58 bytes

{print(jline.TerminalFactory.get().run{"$width $height"})}

Because why not. Turns out the standard lib actually has no way to determine console size so pulling in a library is required, lest you want to gold launching another process and parsing the input stream... would be a shame if somebody did that..

Whoops I had too much free time.

(noncompeting) Java 8 (SE only), Windows, 270 bytes

Marked as noncompeting due to arbitrary restriction of using no external libraries.

interface A{static void main(String[]a)throws Exception{Object[]r=new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec("cmd /c mode").getInputStream())).lines().map(s->s.replaceAll("[^\\d]+","")).toArray();System.out.print(r[3]+" "+r[4]);}}

Ungolfed:

interface A {
    static void main(String[] a) throws Exception {
        Object[] r = new java.io.BufferedReader(
                new java.io.InputStreamReader(
                        Runtime.getRuntime().exec("cmd /c mode")
                                .getInputStream()
                )
        ).lines().map(s -> s.replaceAll("[^\\d]+", "")).toArray();
        System.out.print(r[3] + " " + r[4]);
    }
}
F. George
  • 347
  • 1
  • 10