class a { a() { } String getname() { return "this is a."; } } class b extends a { b() { super(); } String getname() { return super.getname()+"but this is also b"; } } Class bclazz = b.class; a bx = new a(); try { bx = bclazz.newInstance(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } Log.w("Test", bx.getname());
[Result]
08-29 00:01:35.763: WARN/Test(336): this is a.but this is also b
No comments:
Post a Comment