Thursday, 19 February 2015

static Imports garbage Collections

// New  Examples
public class MyClass {
       protected void finalize() throws Throwable {
              System.out.println("this is final");
              throw new ArithmeticException();
       }

       public static void main(String[] args) throws Throwable {

              MyClass class1 = new MyClass();
              // class1.finalize();
              class1 = null;
              System.gc();
              /*Runtime runtime = Runtime.getRuntime();
              runtime.gc();
*/
       }


}



public class MyClass {
       static void m() {
              System.out.println("nani");
       }

       public static void main(String[] args) {

       }

}


package com. sravan.staticimport.myclass;

public class Use {

       public static void main(String[] args) {
              m();

       }

}



public class Use {

       public static void main(String[] args) {
              m();

       }


}

No comments:

Post a Comment