Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #554

Re: Instantiate an abstract class

From Lothar Kimmeringer <news200709@kimmeringer.de>
Newsgroups comp.lang.java.help
Subject Re: Instantiate an abstract class
Date 2011-04-06 18:26 +0200
Organization Organization?! Only chaos here!
Message-ID <c1u7degm55pf$.dlg@kimmeringer.de> (permalink)
References <61c7300d-6011-4639-a5f1-5cd4c58906fa@r4g2000prm.googlegroups.com>

Show all headers | View raw


Rob McDonald wrote:

> When I try it, I get a variety of errors depending on different
> attempts...
> 
> AFoo a = new this.getClass();
> Syntax error on token "this", invalid Name
> 
> AFoo a = new (this.getClass());
> AFoo a = new (this).getClass();
> Syntax error on token "new", ClassType expected after this token
> 
> Suggestions appreciated,

getClass().newInstance();


Regards, Lothar
-- 
Lothar Kimmeringer                E-Mail: spamfang@kimmeringer.de
               PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
                 questions!

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Instantiate an abstract class Rob McDonald <rob.a.mcdonald@gmail.com> - 2011-04-05 14:14 -0700
  Re: Instantiate an abstract class Patricia Shanahan <pats@acm.org> - 2011-04-05 14:37 -0700
    Re: Instantiate an abstract class Rob McDonald <rob.a.mcdonald@gmail.com> - 2011-04-05 14:49 -0700
  Re: Instantiate an abstract class Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-04-05 17:48 -0400
    Re: Instantiate an abstract class Rob McDonald <rob.a.mcdonald@gmail.com> - 2011-04-05 14:54 -0700
      Re: Instantiate an abstract class Patricia Shanahan <pats@acm.org> - 2011-04-05 15:09 -0700
      Re: Instantiate an abstract class Lew <noone@lewscanon.com> - 2011-04-06 12:43 -0400
        Re: Instantiate an abstract class "John B. Matthews" <nospam@nospam.invalid> - 2011-04-06 22:07 -0400
  Re: Instantiate an abstract class Roedy Green <see_website@mindprod.com.invalid> - 2011-04-05 19:02 -0700
  Re: Instantiate an abstract class Roedy Green <see_website@mindprod.com.invalid> - 2011-04-05 19:42 -0700
  Re: Instantiate an abstract class Lothar Kimmeringer <news200709@kimmeringer.de> - 2011-04-06 18:26 +0200
    Re: Instantiate an abstract class Lew <noone@lewscanon.com> - 2011-04-06 12:49 -0400
      Re: Instantiate an abstract class Patricia Shanahan <pats@acm.org> - 2011-04-06 10:09 -0700
      Re: Instantiate an abstract class Lothar Kimmeringer <news200709@kimmeringer.de> - 2011-04-07 01:01 +0200
  Re: Instantiate an abstract class Wojtek <nowhere@a.com> - 2011-04-06 12:41 -0700

csiph-web