Results 1 to 5 of 5

Thread: create object

  1. #1
    paul21 is offline Member
    Join Date
    Nov 2009
    Posts
    12
    Rep Power
    0

    Default create object

    How do make a custom name for an object from a string?

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

    Default

    Quote Originally Posted by paul21 View Post
    How do make a custom name for an object from a string?
    Isn't a custom name a String as well? I'm afraid I don't understand your question.

    kind regards,

    Jos

  3. #3
    Vio
    Vio is offline Member
    Join Date
    Oct 2009
    Location
    Belgium
    Posts
    18
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    Isn't a custom name a String as well? I'm afraid I don't understand your question.

    kind regards,

    Jos
    I think he means creating a new object with the name of a variable of type String.

  4. #4
    paul21 is offline Member
    Join Date
    Nov 2009
    Posts
    12
    Rep Power
    0

    Default

    yes that is what i mean
    Java Code:
    String name ="p";
    forum name = new forum();
    the instance of forum will have the name p

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

    Default

    Quote Originally Posted by paul21 View Post
    yes that is what i mean
    Java Code:
    String name ="p";
    forum name = new forum();
    the instance of forum will have the name p
    It can't be done; the closest you can get is a Map where the 'names' (Strings) are the keys and the objects are the values.

    kind regards,

    Jos

Similar Threads

  1. Create a CLOB object with the string value
    By oshoarun in forum JDBC
    Replies: 1
    Last Post: 03-18-2010, 07:36 PM
  2. create object with name from string
    By skandalouz in forum New To Java
    Replies: 7
    Last Post: 12-06-2009, 12:40 AM
  3. How to create object dinamically and call methods.
    By Gelembjuk in forum New To Java
    Replies: 8
    Last Post: 10-26-2008, 10:28 AM
  4. how to create an object at runtime
    By sireesha in forum New To Java
    Replies: 8
    Last Post: 10-01-2008, 01:52 PM
  5. Automation server can't create object
    By katie in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-06-2007, 11: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
  •