apemanzilla

java 10 fuckery

Mar 20th, 2018
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2.  
  3. class Fuckery {
  4.     public static void main(String[] args) throws IOException, ClassNotFoundException {
  5.         var lambda = (Runnable & Serializable)() -> System.out.println("Hi");
  6.  
  7.         var out = new ByteArrayOutputStream();
  8.         var oos = new ObjectOutputStream(out);
  9.         oos.writeObject(lambda);
  10.         oos.close();
  11.  
  12.         var in = new ObjectInputStream(new ByteArrayInputStream(out.toByteArray()));
  13.         var lambda2 = (Runnable) in.readObject();
  14.         in.close();
  15.  
  16.         lambda2.run();
  17.     }
  18. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×