Results 1 to 12 of 12
  1. #1
    rohitjava is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Post Can we create object without new operator ?

    Can we create object without new operator ?

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,658
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by rohitjava View Post
    Can we create object without new operator ?
    Why do you care? Do you dislike the word "new"?

    kind regards,

    Jos

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  4. #4
    rohitjava is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    Why do you care? Do you dislike the word "new"?

    kind regards,

    Jos
    no actually my trainee say it can be when i ask the ques.?

  5. #5
    rohitjava is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    Why do you care? Do you dislike the word "new"?

    kind regards,

    Jos
    Quote Originally Posted by Fubarable View Post
    One way is with reflection.
    sory but will u pls terr me what is eflection.?

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by rohitjava View Post
    sory but will u pls terr me what is eflection.?
    I can't read your words too well, but I will tell you that this is best answered via a little Googling and Wikipediaing.

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,658
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Fubarable View Post
    Wikipediaing.
    It took me a couple of seconds before I realized that you verbed a proper noun; you Fubarabled me completely ;-)

    kind regards,

    Jos

  8. #8
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Sent to me via private message:
    Quote Originally Posted by rohitjava
    hi , actually i am a trainee now and i asked a simple ques to my trainee sir that can a object be created without new operator.....so u answered me through reflection..but what is this would tell me what the reflection is?

    Thanks
    -Rohit
    Reply:
    This topic is very general and broad and difficult to answer easily within the confines of a forum, and you and I really don't want me, a volunteer, to recreate tutorial chapters that have already been well created by others, better than I ever could. And this is why I recommended (and still do) that you first Google this, read the tutorials, and only then if you still have specific questions, ask them. To get you started, please click here:
    The Reflection API

    Luck

  9. #9
    rohitjava is offline Member
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default

    Ok.. Thanks

  10. #10
    siva_vs_siva is offline Member
    Join Date
    Aug 2010
    Posts
    31
    Rep Power
    0

    Default

    you can use this way also

    classname obj=Class.forName("classname").newInstance();

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default

    Which is reflection...

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 02:12 AM
  2. Replies: 2
    Last Post: 06-22-2010, 04:29 AM
  3. create object
    By paul21 in forum New To Java
    Replies: 4
    Last Post: 03-07-2010, 07:14 PM
  4. create object with name from string
    By skandalouz in forum New To Java
    Replies: 7
    Last Post: 12-05-2009, 11:40 PM
  5. String Object equality with == operator
    By kumar080780 in forum New To Java
    Replies: 4
    Last Post: 10-29-2008, 06:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •