Object creation of string

Hello
Please tell me what is the difference between these two object creation of string.
String str = new String("Hello");.
String str="Hello";
Thanks.

RGEO wrote:
hello,
Is the string pool is part of a heap? Huh? I suppose yes, you could regard the String pool as part of the heap... but (I guess) that interned String objects would be placed directly into the permanent generation, which is not garbage collected... and therefore I don't really think of the permanent generation as part of the heap (except when tuning heap allocations)... but I think I'm talking over your noob head here, yes... and so to the noob-stuff.
If you get bored you might like to scan (for now) http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#generations ... and come back to it in a couple of years time (when every second word isn't new and baffling to you;-)
jvm what will do when he encounter the following code,
String s1 = new String ("hello");The VM will:
1. Create a new String object, and then
2. copy the characters 'h','e','l','l','o' from the interned String "hello" to the new String,
3. and then assign a reference to the new String to variable s1.
Note that the result is subtley different from String s1 = "hello", which just does step 3... it assigns a reference to the existing interned String object "hello" to the variable s1... it does not create and "populate" a new String object.
Try this just for fun... what is the output of the following program? Why?
package forums;
public class StringEquals
  public static void main(String[] args) {
    try {
      String a = "Hello";
      String b = "Hello";
      System.out.println("a==b is "+(a==b));
      String c = new String("Hello");
      System.out.println("a==c is "+(a==c));
    } catch (Exception e) {
      e.printStackTrace();
}Now, what's the correct way to evaluate equality of String objects in Java?
HTH. Cheers. Keith.

Similar Messages

  • Use String Variable in New Object Creation

    Thanks to those who review and respond. I am new to Java, so please be patient with my terminoloy mistakes and fumblings. I am reading in a file and I want to create a new object based on specific field (car for example). As you will notice I grab field 8 here label sIID.
    String sIID = dts.group(8);
    BTW this regex grouping works fine. The problem is seen when I try to use the sIID variable in my new object creation process.
    DateParse sIID = new DateParse();
    My IDE is reporting "Variable sIID is already defined in the scope"
    Is this possible? The assumption is that the sIID will have different value during the processing of the file. For example, car could mean truck, sedan, etc with operators like color, number of doors, mileage, top speed, etc.

    Thanks for the reply. I have include similar and much shorter code for the sake of brevity.
    My problems are centered around the x variable/object below. Ideally this would translate to three objects PersonA, PersonB, etc that I could reference later in the code as PersonA.newname if I wanted to. Hopefully this makes sense.
    public class TestingObjects {
      public static void main(String[] argv) {
           String [] names;
           names = new String[3];
           names[0] = "PersonA";
           names[1] = "PersonB";
           names[2] = "PersonC";
           for (String x:names) {
             PN x = new PN();  // <- Problem
             x.name = x;
             x.SayName();
            System.out.println(x.newname);
    public class PN {
           String name;
           String newname;
      public String SayName() {
           newname = "Name = " + name;
           System.out.println(name);
          return newname;
    }

  • Java Object Creation

    A general question about how can Java object creation with an average amount of data retrieval is considered as a reasonable.
    For example if I am clicking on a link in a web application...to paint that page, I think, about 4-5 java object with an average data retrieval of 20 rows wud be considered as appropriate. Any other thoghts or any other parameters to take into consideration?

    If you are concerned about object creation speed, you probably shouldn't. Even my laptop PC can create and garbage collect some 12 million objects per second (10,000,000 objects takes about 800 milliseconds). Test program below; remember to run with "java -server" to get the faster optimizing compiler. For laughs, write an equivalent C++ program that does new&delete in a similar loop.
    public class CreateObject
        public static void main(String args[])
         throws Exception
         for (int m = 0; m < 5; m++)
             doit();
        static void doit()
         long start = System.currentTimeMillis();
         for (int n = 0; n < 10 * 1000 * 1000; n++) {
             new CreateObject();
             new CreateObject();
             new CreateObject();
             new CreateObject();
             new CreateObject();
             new CreateObject();
             new CreateObject();
             new CreateObject();
             new CreateObject();
             new CreateObject();
         long end = System.currentTimeMillis();
         System.out.println((end - start) + " ms");
    }

  • Frequent Object Creation vs. synchronized

    HI all,
    I'm just looking to prompt a discussion I can learn from. Apologies if I'm missing something.
    Having just read the excellent articles over at:
    http://www-106.ibm.com/developerworks/java/library/j-threads1.html
    http://www-106.ibm.com/developerworks/java/library/j-threads2.html
    http://www-106.ibm.com/developerworks/java/library/j-threads3.html
    I was left wondering about the (largely unmentioned) trade-off between object creation and use of synchronization.
    If a particular part of a given system is heavily accessed then one might consider instantiating, and caching references to, components in an initialisation stage. In a multithreaded environment, this can obviously pose a problem.
    If these components aren't threadsafe then at some point use will have to be made of a synchronized block, unless the unsafe components are instantiated for every thread.
    The articles do mention the overrated cost of synchronization - how does this compare with the cost of frequent object instantiation?
    Thanks for your time,
    JohnG

    Well, let's time it (test program below):
    using no synchronization: 180 ms (baseline measurement, not thread safe)
    using new: 1111 ms
    using uncontended sync: 491 ms
    using contended sync: 49531 ms
    new is fast - ten million temporary object allocations and frees per second. A magnitude faster than in traditional malloc()/free() -based languages. new is rarely a performance problem in Java programs.
    Uncontended locks are fast - twenty million per second.
    Heavily contended locks slow you down. Way down. A second becomes a minute.
    Don't try to optimize unless you have measured a real performance bottleneck.
    Object pooling is unlikely to help. Exceptions being objects that are expensive to initialize and are created often (e.g. large buffers or arrays, cryptographic engines that take time to initialize, or connections to external systems such as databases). You'll need to measure first if object creation really is the bottleneck.
    public class t
        static class Calculator
         private int value;
         void initialize(int n)
             value = n;
         int result()
             return value * 2;
        static class NewThread
         extends Thread
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              Calculator x = new Calculator();
              x.initialize(n);
              result += x.result();
        static class SyncThread
         extends Thread
         static Calculator x = new Calculator();
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              synchronized (x) {
                  x.initialize(n);
                  result += x.result();
        // Not thread safe
        static class BaselineThread
         extends Thread
         static Calculator x = new Calculator();
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              x.initialize(n);
              result += x.result();
        public static void main(String args[])
         throws Exception
         int thread_count = 10;
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++) {
              // threads run consecutively, not in parallel
              (threads[m] = new BaselineThread()).start();
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using no synchronization: " +
                          (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++)
              (threads[m] = new NewThread()).start();
             for (int m = 0; m < thread_count; m++)
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using new: " + (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++) {
              // threads run consecutively, not in parallel
              (threads[m] = new SyncThread()).start();
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using uncontended sync: " +
                          (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++)
              (threads[m] = new SyncThread()).start();
             for (int m = 0; m < thread_count; m++)
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using contended sync: " +
                          (end - start) + " ms");
    }

  • How do i convert an object into a string?

    has said above, im trying to convert a object to a string.
    here is what i ahve so far:
    Object nodeInfo = node.getUserObject()

    RTFM
    Object o =...
    String str = o.toString();

  • How to show object creation in UML

    How to show object creation in UML

    In a sequence diagram, it's a line (with arrow) pointing to the new object and the <creates> or <new> tag as mentioned above.
    | obj 1  |
         |
         |    <creates>     ----------
         | -------------->  | obj 2  |
         |                  ----------or----------
    | obj 1  |
         |
         |      <new>       ----------
         | -------------->  | obj 2  |
         |                  ----------

  • Can you create an object from a string

    I have been working on creating a dynamic form, creating the
    form items from an xml file. I am getting very close to conquering
    this task. I will share it when it's complete.
    However, I am stuck at the moment trying to create an object
    from a string. For example, if the xml item is an HBox I want to
    create an HBox. Like this: parentObject = new arrayOfFormItems[
    index ]..type ()
    This isn't working. First, is this possible using some syntax
    I am unaware of in Flex? I don't want to use a large if or case
    statement if possible.
    Thanks in advance for your help!

    Thank you very much. Indeed that did solve the one problem. I
    missed the casting as a Display Object. That is awesome!
    I do still however, have to instantiate one of every item I
    want to dynamically create or I get the following error when I try
    to create a dynamic object that I have not instantiated before.
    ReferenceError: Error #1065: Variable HBox is not defined.
    at global/flash.utils::getDefinitionByName()
    at MyForm/buildForm()
    at DynamicForm/::onComplete()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    I read that you have no choice but to instantiate one of each
    type to force the linker to link the code for that class into the
    .swf. Unless you know another way to force it.
    This is what I have in my Application mxml to get it to work:
    <mx:HBox>
    <mx:Text visible="false"/>
    <mx:TextArea visible="false"/>
    <mx:TextInput visible="false"/>
    <mx:DateField visible="false"/>
    </mx:HBox>
    And those are the types I'm using to test with. . . I will
    have to add all the others I want to use as well . . .

  • FIM MA Export errors. There is an error executing a web service object creation.

    While checking for the permission, we have figured that the Built-In Synchronization account is being deleted by an Expiration Workflow.
    FIM MA Export errors. There is an error executing a web service object creation.
    While checking for the permission, we have figured that the Built-in Synchronization account was deleted by an Expiration Workflow
    Is there a way to restore. Thanks.

    I would re-run FIM setup - I think it can re-create this account
    If you found my post helpful, please give it a Helpful vote. If it answered your question, remember to mark it as an Answer.

  • Xdb_installation_trigger does not support object creation of type SNAPSHOT

    hi everyone, i'm using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit on solaris sparc 5.10
    we like to send an email through SSL, and after searching here and there I found out that oracle DB 11g able to go throught the SSL.
    since upgrade our DB to 11g would not be an option, so i tried to export XDB of 11g and import it into XDB 10gR2 schema, it was a mess...
    then i just reinstall XDB using catnoqm.sql & catqm.sql
    and now one of our programmer cant run some script like above
    CREATE MATERIALIZED VIEW FIFSYS_MKT_SCHEME_MV_COY
    TABLESPACE MARKETING_TABLES
    PCTUSED    40
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
    INITIAL          64K
    MINEXTENTS       1
    MAXEXTENTS       UNLIMITED
    PCTINCREASE      0
    FREELISTS        1
    FREELIST GROUPS  1
    BUFFER_POOL      DEFAULT
    +)+
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH FORCE ON DEMAND
    WITH PRIMARY KEY
    AS
    +/* Formatted on 9/23/2010 1:07:42 PM (QP5 v5.114.809.3010) */+
    SELECT   coy_id,
    appl_branch_id,
    appl_object_code,
    product_type,
    ppdcf_paid_date,
    SUM (scheme_adm) scheme_adm,
    SUM (appl_unit) appl_unit,
    SYSDATE mkt_sysdate
    FROM   (SELECT   NVL (a.coy_id, '01') coy_id,
    a.branch_id appl_branch_id,
    DECODE (a.buss_unit, 'NMC', '2101', 'UMC', '2102', '2352')
    appl_object_code,
    a.platform product_type,
    TRUNC (c.contract_active_date) ppdcf_paid_date,
    NVL (s.ms_amt, 0) scheme_adm,
    NVL (o.total_item, 0) appl_unit
    FROM   ordmgmt.om_trn_appl_ms_lvl_object s,
    ordmgmt.om_trn_appl_hdr a,
    acctmgmt.ar_trn_sum_contracts c,
    +( SELECT appl_no, COUNT ( * ) total_item+
    FROM   ordmgmt.om_trn_appl_object
    GROUP BY   appl_no) o
    WHERE       s.appl_no = a.appl_no
    AND a.appl_no = o.appl_no
    AND s.ms_code IN ('MS03', 'MS14')
    AND c.appl_no = a.appl_no
    AND c.contract_no = a.contract_no
    +/*AND c.office_code = a.branch_id*/+
    AND NVL (a.coy_id, '01') = NVL (c.coy_id, '01'))
    GROUP BY   coy_id,
    appl_branch_id,
    appl_object_code,
    product_type,
    ppdcf_paid_date;
    COMMENT ON MATERIALIZED VIEW FIFSYS_MKT_SCHEME_MV_COY IS 'snapshot table for snapshot MARKETING.FIFSYS_MKT_SCHEME_MV_COY';
    and this error shown:
    ORA-00604 error occurred at recursive SQL level 1
    ORA-20000 Trigger xdb_installation_trigger does not support object creation of type SNAPSHOT
    ORA-06512 at line 32
    maybe some of you know how to solve this problem??
    and, this in the script of the xdb_installation_trigger
    DROP TRIGGER SYS.XDB_INSTALLATION_TRIGGER;
    CREATE OR REPLACE TRIGGER SYS.xdb_installation_trigger
    BEFORE
    CREATE ON DATABASE
    DECLARE
    sql_text varchar2(200);
    val number;
    BEGIN
    if (dictionary_obj_owner != 'XDB') then
    if (dictionary_obj_type = 'FUNCTION' or
    dictionary_obj_type = 'INDEX' or
    dictionary_obj_type = 'PACKAGE' or
    dictionary_obj_type = 'PACKAGE BODY' or
    dictionary_obj_type = 'PROCEDURE' or
    dictionary_obj_type = 'SYNONYM' or
    dictionary_obj_type = 'TABLE' or
    dictionary_obj_type = 'TABLESPACE' or
    dictionary_obj_type = 'TYPE' or
    dictionary_obj_type = 'VIEW' or
    dictionary_obj_type = 'USER'
    +)then+
    if (dictionary_obj_type  != 'PACKAGE BODY'
    +) then+
    sql_text := 'select count(*) from ALL_OBJECTS where owner = :1 and object_name = :2 and object_type = :3';
    execute immediate sql_text into val using dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type;
    if (val = 0) then
    sql_text := 'select count(*) from dropped_xdb_instll_tab where owner = :1 and object_name = :2 and object_type = :3';
    execute immediate sql_text into val using dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type;
    if (val = 0) then
    insert into xdb_installation_tab values
    +(dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type);+
    end if;
    end if;
    end if;
    else
    raise_application_error(-20000, 'Trigger xdb_installation_trigger does not support object creation of type '||dictionary_obj_type);
    end if;
    end if;
    end;
    +/+
    /********************************************************************************/

    i'm so careless, after checking a fresh installation of the same version DB, i dont found xdb_installation_trigger.
    so just by simply remove that trigger & everything works just fine. :)

  • Setting the name of a new object from a string

    Is there anyway I can set the object name of a newly created
    object from a string?
    eg.
    (the code below generates a compile time error on the
    variable declaration)
    public function addText(newTxt:String, txt:String,
    format:TextFormat):void {
    var
    this[newTxt]:TextField = new TextField();
    this[newTxt].autoSize = TextFieldAutoSize.LEFT;
    this[newTxt].background = true;
    this[newTxt].border = true;
    this[newTxt].defaultTextFormat = format;
    this[newTxt].text = txt;
    addChild(this[newTxt]);
    called using>
    addText("mytxt", "test text", format);
    I could then reference the object later on without using
    array notation using mytxt.border = false; for example
    There are many a time when I want to set the name of a new
    object from a string.
    In this example I have a function that adds a new text object
    to a sprite.
    The problem is, if I call the function more than once then
    two textfield objects will exist, both with the same name. (either
    that or the old one will be overwritten).
    I need a way of setting the name of the textfield object from
    a string.
    using
    var this[newTxt]:TextField = new TextField()
    does not work, If I take the "var" keyword away it thinks it
    a property of the class not an object.
    resulting in >
    ReferenceError: Error #1056: Cannot create property newTxt on
    Box.
    There must be a way somehow to declare a variable that has
    the name that it will take represented in a string.
    Any help would be most welcome
    Thanks

    Using:
    var this[newTxt]:TextField = new TextField()
    is the right approach.
    You can either incrment an instance variable so that the name
    is unique:
    newTxt = "MyName" + _globalCounter;
    var this[newTxt]:TextField = new TextField();
    globalCounter ++;
    Or store the references in an array:
    _globalArray.push(new TextField());
    Tracy

  • Cost of object creation vs reflection?

    How does the cost of invoking a method using reflection compare to the cost of object creation? Thank you,
    ranko

    i agree. in such cases, you should do the simplest thing that could possibly work. there are legitimate uses for reflection. without reflection, we have no core serialization mechanism. without serialization, we have no core RPC mechanism (RMI). no dynamic proxies without reflection. all those neat visual building tools are hampered without reflection. ORBs and scripting languages like Jython are hindered.
    note that the legitimate uses of reflection shown above tend to be for core JDK, or for development tools. that should be a clue to the developer that unless you're building these kinds of systems, you should reconsider whether reflection is necessary.
    that said, reflection has a high "cool" factor. i think that's what sucks developers toward it. it sucked me in, that's for sure. 8^)
    --p

  • While Loop - Object Creation

    Hello,
    I have a question on object creation and while loops. Have a look at the following code snippet:
    while(true)
           Object obj = new Object();
           // Pass off obj to a new thread
           Thread job = new Thread(new ObjectHandler(obj));
           job.start();
    }My question is, do I have to wait until the newly created Thread is finished with the Object obj before I can create a new Object called obj in the while loop?
    Also does anyone have any documentation on this sort of thing?
    Thanks,
    Tony.

    Jaxie wrote:
    I'm still not sure you get what I'm on about, you might want to read up on java methods and pass by value.I think we know how it works. Most of us have been programming in Java for serveral years.
    >
    When you pass an object to a method in java you pass it a copy of a reference to that object. Leading on from that, before an object is eligible for garbage collection in java, all references to that object must be dropped.
    So with all that in place, my question was, is the creation of an object in a while loop dependent on previous objects of the same name? Objects don't have names. Have we mentioned that before?
    You have a reference, larry that is referencing an unnamed object. You can also create other references that reference the same object. The thread will have one reference. You can then make larry reference another object. That will not change anything in the thread. It will still reference the old object, and that object will not be claimed by the gc until that thread stops referencing it.
    So the second time we go through the loop below, do we have to wait until larry has been garbage collected, before a new larry can be created?Read the articles/tutorials and what I have written above. What do you think?
    Do also note that the GC isn't executed synchronously.

  • How to create a Document object from a string.

    If I use the following code, the input String cannot contain "\n", otherwise, it generates errors.
    in the following code, inputXMLString is a String object that has xml content.
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(new InputSource(new StringReader(inputXMLString)));          How can I create a Document object from a string with "\n" in the string?
    Thanks.

    If I use the following code, the input String cannot
    contain "\n", otherwise, it generates errors.That's going to be a huge surprise to thousands of people who process XML containing newline characters every day without errors.
    Perhaps your newline characters are in the middle of element names, or something else that causes your XML to be not well-formed. I'm just guessing here, though, because you didn't say what errors you were getting.

  • Convert an Object into a String

    Good day to everyone. I am trying to do a little coding in which a user will input his desired username. I want to check the database if the desired username of the current user is existing, so there'll be no duplication. I'm using JPA for the model and JSF for the controller and view.
    Here's my Model.
    @Entity
    public class WebUser implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        private String lastName;
        private String firstName;
        private String middleName;
        private String username;
        private String password;
        public Long getId() {
            return id;
        public void setId(Long id) {
            this.id = id;
        @Override
        public int hashCode() {
            int hash = 0;
            hash += (id != null ? id.hashCode() : 0);
            return hash;
        @Override
        public boolean equals(Object object) {
            // TODO: Warning - this method won't work in the case the id fields are not set
            if (!(object instanceof WebUser)) {
                return false;
            WebUser other = (WebUser) object;
            if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
                return false;
            return true;
        @Override
        public String toString() {
            return "web.model.WebUser[id=" + id + "]";
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getMiddleName() {
            return middleName;
        public void setMiddleName(String middleName) {
            this.middleName = middleName;
        public String getUsername() {
            return username;
        public void setUsername(String username) {
            this.username = username;
        public String getPassword() {
            return password;
        public void setPassword(String password) {
            this.password = password;
    }The controller and jsp are auto-generated from Netbeans. My question is, how will I convert the 'WebUser' object into a String so I can compare the value from input text to the value in the database?
    Here is my validation method inside WebUserController.java
    public void validateUsername(FacesContext facesContext, UIComponent component, Object value) throws ValidatorException {
            String newUsername = (String) value;
            System.out.println("new user name: " +newUsername);
            System.out.println("component: " +component);
            int webUserSize;
            StringBuffer sb = new StringBuffer();
            //webUsers.toString();
            if ((webUsers == null) || (webUsers != null)) {
                System.out.println("web users null");
                List<WebUser> allWebUsers = getWebUsers();
                webUserSize = allWebUsers.size();
                System.out.println("all web users: " +allWebUsers);
                System.out.println("size " +webUserSize);
                for(int i=1; i<=webUserSize; ++i) {
                    sb.append(allWebUsers);
                    System.out.println("username: " +sb.append(allWebUsers));
            }Honestly I'm new to java and having a hard time with this one. Hope someone can help me. Thanks a lot.
    I know my code is a mess. :(

    Thanks for the help guys! I used the "unique constraint" annotation of JPA and my problem is solved.
    Here's the code:
    @Entity
    @Table(
        name="WebUser",
        uniqueConstraints={@UniqueConstraint(columnNames={"username"})}
    public class WebUser implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        private String lastName;
        private String firstName;
        private String middleName;
        private String username;
        private String password;
        public Long getId() {
            return id;
        public void setId(Long id) {
            this.id = id;
        @Override
        public int hashCode() {
            int hash = 0;
            hash += (id != null ? id.hashCode() : 0);
            return hash;
        @Override
        public boolean equals(Object object) {
            // TODO: Warning - this method won't work in the case the id fields are not set
            if (!(object instanceof WebUser)) {
                return false;
            WebUser other = (WebUser) object;
            if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
                return false;
            return true;
        @Override
        public String toString() {
            //return "web.model.WebUser[id=" + id + "]";
            return "web.model.User[username=" + username +"]";
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getMiddleName() {
            return middleName;
        public void setMiddleName(String middleName) {
            this.middleName = middleName;
        public String getUsername() {
            return username;
        public void setUsername(String username) {
            this.username = username;
        public String getPassword() {
            return password;
        public void setPassword(String password) {
            this.password = password;
    }Thanks again guys!

  • Cast Object Array to String Array.

    When I try to cast an object array to string array an exception is thrown. How do I go about doing it?
    Vector temp = new Vector();
    Object[] array = temp.toArray();
    String[] nonterms;                              
    nonterms = (String[])array;
    Thanks,
    Ally

    Try this
    import java.util.Vector;
    public class Test
         public static void main(String args[]) throws Exception
              Vector v = new Vector();
              v.add("a");
              v.add("b");
              v.add("c");
              Object[] terms = v.toArray();
              for(int i = 0; i < terms.length; i++)
                   System.out.println((String)terms);
    Raghu

Maybe you are looking for

  • Which Driver for MS SQL-Server 2000

    Hello, i need to access a MS SQL-Server 2000 and want to ask which driver you think is the best one for this problem. I am not a big fan of using beta-Software, and i do not need the newest state-of-the-art features. Right now i also do not need Conn

  • Maps Problem with Glitchy Map Display

    I've been having a problem with Maps recently. Lately, I've been scrolling across maps and very (very) often I would have a really glitchy layout that looks like this: http://img137.imageshack.us/img137/442/mapsproblemrr6.png This occurs on both 3G a

  • Content Caching with NM-CE

    Hi Folks, My CE is currently running in our network for few days but we encouter some unusual symtoms like; 1) The web broswer will hang with a blank page without displaying any item. After a while, everything will come out instantaneously. For big w

  • Calling one WAD Report from another WAD Report

    Hi All,           I want to Call one WAD report from another WAD Report and I want to show that Report in a Container of the Calling Report Itself. Kindly give the Solution. Thanks for your support in advance. Thanks & Regards Shiva

  • How to get contacts and calendar info from my old palm files

    I used to use a Palm Tungsten T3. I no longer have it but until recently I still used the Palm Desktop. My computer "died" and I was able to copy all the Palm files of of it but now I have no idea how to get the contact and calendar(less important th