Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Well, well, all your examples are just unhandled exceptions. Usually by "drop" they mean more fun things. Let's take Unsafe and read a byte at address zero.
import sun.misc.Unsafe;
public class CrashTheJVM
{
private static final Unsafe UNSAFE = createUnsafe();
private static Unsafe createUnsafe()
{
try
{
Field uf = Unsafe.class.getDeclaredField("theUnsafe");
uf.setAccessible(true);
return (Unsafe) uf.get(null);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
public static void main(String[] args)
{
UNSAFE.getByte(0);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question