title: What happen if I manually changed the bytecode before running it?
body: <p>I am little bit curious about that what happen if I manually changed something into <strong>bytecode</strong> before execution. For instance, let suppose <strong>assigning int type variable into byte type variable without casting</strong> or <strong>remove semicolon from somewhere in program</strong> or anything that leads to <strong>compile time error</strong>. As I know all <strong>compile time errors</strong> are checked by <strong>compiler</strong> before making <code>.class</code> file. So what happen when I changed byte code after successfully compile a program then changed bytecode manually ? Is there any mechanism to handle this ? or if not then how program behaves after execution ?</p>
  
  <p><strong>EDIT :-</strong><br>
  As Hot Licks, Darksonn and manouti already gave correct satisfy answers.Now I just conclude for those readers who all seeking answer for this type question :-</p>
  
  <p>Every <strong>Java virtual machine</strong> has a class-file <strong>verifier</strong>, which ensures that loaded class files have a proper internal structure. If the class-file verifier discovers a problem with a class file, it <strong>throws</strong> an <strong>exception</strong>. Because a class file is just a sequence of binary data, a virtual machine can't know whether a particular class file was generated by a well-meaning Java compiler or by shady crackers bent on compromising the integrity of the virtual machine. As a consequence, all JVM implementations have a class-file verifier that can be invoked on untrusted classes, to make sure the classes are safe to use.</p>
  
  <p>Refer <a href="http://www.javaworld.com/article/2077038/core-java/security-and-the-class-verifier.html" rel="nofollow">this</a> for more details.</p>