Skip to main content
Commonmark migration
Source Link

#Java, 101 98 62 42 bytes

Java, 101 98 62 42 bytes

()->{Runtime.getRuntime().exec("init 0");}

As @Snowman pointed out, the question didn't specify if a full program was needed, so this should still be acceptable.

#Java, 101 98 62 42 bytes

()->{Runtime.getRuntime().exec("init 0");}

As @Snowman pointed out, the question didn't specify if a full program was needed, so this should still be acceptable.

Java, 101 98 62 42 bytes

()->{Runtime.getRuntime().exec("init 0");}

As @Snowman pointed out, the question didn't specify if a full program was needed, so this should still be acceptable.

edited body
Source Link
Tom
  • 3.1k
  • 8
  • 22

#Java, 101 98 6262 42 bytes

void f()throws Exception->{Runtime.getRuntime().exec("init 0");}

As @Snowman pointed out, the question didn't specify if a full program was needed, so this should still be acceptable.

#Java, 101 98 62 bytes

void f()throws Exception{Runtime.getRuntime().exec("init 0");}

As @Snowman pointed out, the question didn't specify if a full program was needed, so this should still be acceptable.

#Java, 101 98 62 42 bytes

()->{Runtime.getRuntime().exec("init 0");}

As @Snowman pointed out, the question didn't specify if a full program was needed, so this should still be acceptable.

Shortened code with a function, so Java 8 is not needed because an interface isn't used
Source Link
Tom
  • 3.1k
  • 8
  • 22

#Java (versions 8+), 101 9898 62 bytes Windows

interface C{static void mainf(String[]a)throws Exception{Runtime.getRuntime().exec("shutdown/s""init 0");}}

As @Snowman pointed out, the question didn't specify if a full program was needed, so this should still be acceptable.

#Java (versions 8+), 101 98 bytes Windows

interface C{static void main(String[]a)throws Exception{Runtime.getRuntime().exec("shutdown/s");}}

#Java, 101 98 62 bytes

void f()throws Exception{Runtime.getRuntime().exec("init 0");}

As @Snowman pointed out, the question didn't specify if a full program was needed, so this should still be acceptable.

Interfaces don't allow the use of static below Java 8
Source Link
Loading
added 17 characters in body
Source Link
Tom
  • 3.1k
  • 8
  • 22
Loading
added 7 characters in body
Source Link
Tom
  • 3.1k
  • 8
  • 22
Loading
Source Link
Tom
  • 3.1k
  • 8
  • 22
Loading