public class A { int x=22; public static void show(int xy) { System.out.println("show with one parameter :"+xy); } public void show() { System.out.println("show with zero parameter "); } } class Programmer { public static void main(String ar[]) { A obj=new A(); obj.show(); A.show(5); System.out.println(obj.x); } }
import java.lang.reflect.*; import java.util.*; class A { public A() { System.out.println("A class instance created"); } static { System.out.println("static of A"); } } class B { public B() { System.out.println("B class instance created"); } static { System.out.println("static of B"); } } class Blog { public static void main(String ar[])throws Exception { Scanner scan=new Scanner(System.in); String str=scan.nextLine(); Class cc=Class.forName(str); cc.newInstance(); } }
Comments
Post a Comment