Results 1 to 9 of 9
  1. #1
    sireesha is offline Member
    Join Date
    Nov 2007
    Posts
    50
    Rep Power
    0

    Question how to create an object at runtime

    Hi All,
    I have few questions in java.I read these questions in a site,mentioned for interview questions.But no answers are provided in that site. Any one please give me answers for these questions.
    1. how to create an object at runtime?
    2. what are disadvantages of multithreading programing ?
    3. what is client side refresh,server side push ?

    Any help is appreciated.
    Thanks,
    sireesha.

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

    Default

    For the first question, you can use newInstance() to create object of a class at run-time.

    For the second question, I don't see any disadvantages, multithreading use heavily in my application and it gives lots of advantages to me.

    I'm not clear what's your third question.

  3. #3
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default

    Er, all objects are created at runtime. The 'new' keyword also creates objects at runtime

  4. #4
    ShoeNinja's Avatar
    ShoeNinja is offline Senior Member
    Join Date
    Oct 2007
    Posts
    124
    Rep Power
    0

    Default

    Do you not know the type of object you need until runtime?

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

    Default

    Quote Originally Posted by georgemc View Post
    Er, all objects are created at runtime. The 'new' keyword also creates objects at runtime
    Yes, that's true all objects are created in runtime. Say I change the topic to "how to get a class object at runtime" make sense.

  6. #6
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by sireesha View Post
    2. what are disadvantages of multithreading programing ?
    A quick google would answer most of your questions. While we love to help, you have to do a tiny bit of work first.

    Multi-threading is how you improve responsiveness of GUI applications.

    Multi-threading is how you use today's quad processors and tomorrows 16 and 32 processor chips.

    The disadvantage is that doing it right is hard. Or perhaps this is good, since it will separate the real developers from the folks who read "21 days to be a Java Programmer" and claim that they are professional developers.

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

    Default

    Quote Originally Posted by fishtoprecords View Post
    The disadvantage is that doing it right is hard.
    Yes it is, actually lots of people worried about how to deal with two threads, I mean main and addition one.

  8. #8
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    Yes, that's true all objects are created in runtime. Say I change the topic to "how to get a class object at runtime" make sense.
    Well, not really, since that's not what the OP asked!

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

    Default

    Ya, seems my fault. Because I thought he's talking about that. Looking his some past replays, if he has no idea that objects are creating in runtime, I'm wired. He doesn't know about objects.

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 02:12 AM
  2. Replies: 1
    Last Post: 07-22-2008, 04:27 PM
  3. Replies: 1
    Last Post: 04-09-2008, 02:15 AM
  4. How to cast an Object into a specific type (Integer/String) at runtime
    By mailtogagan@gmail.com in forum Advanced Java
    Replies: 2
    Last Post: 12-03-2007, 01:04 PM
  5. Automation server can't create object
    By katie in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-06-2007, 10:53 PM

Posting Permissions

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