String problem again!!

I have a string and I wanted to keep it's value evenwhen it passes from one method to another!!
Is this possible in any way!?
Ie acts like an object rather then like a primitive?

Not exactly ...
In the example below the value of a dosent change.
public class Test{
     public Test(){
          String a = "Hello, World [1]";
          String b = updateHelloWorld(a);
          // Value of 'a' did not change.
          System.out.println(a);
          System.out.println(b);
     public String updateHelloWorld(String a){
          a = "Hello, World [2]";
          return a;
     public static void main(String[] args){
          new Test();
     class StringContainer{
          String aString;
}While in the following example the value a changes because the string is raped in another object!
public class Test{
     public Test(){
          StringContainer a = new StringContainer("Hello, World [2]");
          StringContainer b = updateHelloWorld(a);
          // Value of 'a' does change!!!.
          System.out.println(a.aString);
          System.out.println(b.aString);
     public StringContainer updateHelloWorld(StringContainer a){
          a.aString = "Hello, World [2]";
          return a;
     public static void main(String[] args){
          new Test();
     class StringContainer{
          public String aString;
          public StringContainer(String aString){
               this.aString = aString;
}

Similar Messages

  • The same problem again with HP Simple Pass fingerprint reader after upfrading from Firefox 4 to Firefox 5. I have already installed HPSimPlePass 7.0.74.0 to fix the problem after upgrading to Firefox 4.

    I have a HP Pavilion dv6 with a fingerprint reader. I had the same problem as many other people when upgrading to Firefox 4, : I couldn't use the HP Simple Pass to enter a website needing a username and password by just swiping my fingerprint. I fixed the problem by downloading the new HPSimPlePass 7.0.74.0. This fixed the problem and I was very happy. Since upgrading to Firefox 5 I have the same problem again, but I already have the new version of HP Simple Pass. How can this be fixed so that I can use this fingerprint scan feature again, or where can I download Firefox 4 again?

    ''FredMcD [[#answer-709783|said]]''
    <blockquote>
    The programers know of this and are working on it.
    </blockquote>

  • Audio Render Problems Again

    I'm having problem again rendering a one hour presentation. If I use Command/R, the dialog box indicates seven or more days. If I highlight the selection I get essentially the same estimated time.
    Command/R usually works, but not this time. Audio For Playback is checked.
    The DV timeline plays in Quick Time OK.
    I desperately need to get this video sent out! I even deleted preferences using the "Preference Manager" program.
    David

    All of my lecture video series are recorded in LP 16 bit audio. Each lecture is between 1 to 1.5 hr in length. I have successfully completed 10 of the 23.
    Each lecture is sent to iMovie HD and then the timeline.mov is placed into FCE. One other time the timeline audio would not render, so I converted it to DV via MPEG Stream Clip and placed it back into FCE. The lecture I'm having trouble with is #11.
    As mentioned, usually Command-R will do the trick in 10 minutes or so, not 6 to 10 days.
    David

  • Explorer problem again????

    I got explorer.exe problem again,which was solved previously  by creating new user account.I am free from problem for around 1 month and started again, and this time very frequently i am getting windows with message that
    "Windows Explorer has  stopped working".I am using windows 7 professional service pack 1.Please any body give permanent solution to this problem,Problem details are below
    Problem signature:
      Problem Event Name:    AutoVerifierV2
      Application Name:    explorer.exe
      Application Version:    6.1.7600.16450
      Application Timestamp:    4aeba271
      Fault Module Name:    verifier.dll
      Fault Module Version:    6.1.7600.16385
      Fault Module Timestamp:    4a5bdb2a
      Exception Code:    80000003
      Exception Offset:    0000c0de
      Status Code:    201
      OriginalBucketID:    0
      OS Version:    6.1.7600.2.0.0.256.48
      Locale ID:    1033
      Additional Information 1:    e903
      Additional Information 2:    e90395e1c160c582c0a3c5e6d36ee788
      Additional Information 3:    f03b
      Additional Information 4:    f03b4ab77c5a1d7b156e29c2436e59a6

    Hello,
    The TechNet Sandbox forum is designed for users to try out the new forums functionality. Please be respectful of others, and do not expect replies to questions asked here.
    Since your post is off-topic, I am moving it to the
    off topic forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • When i want to install windows7 on my snow leopard(10.6.4) with boot camp assistant,said that you must update your mac,i do this and try to install windows7 again but i have this problem again?what can i do?

    when i want to install windows7 on my snow leopard(10.6.4) with boot camp assistant,said that you must update your mac,i do this and try to install windows7 again but i have this problem again?what can i do?

    Graham Giles wrote:
    Have you seen this type of problem before? I think it could be a serious issue for anyone in a similar position.
    No; but then, I've not had occasion to use TDM. I've been using firerwire drives for over 10 years, both FW400 and FW800, with no issues except a bit of instability using a B&W G3 machine.
    TDM should be safe. Using cautious, manual copying of files from the Target machine to the Host machine should not result in unexpected loss of files or damage to the Target drive's directories. It should behave exactly the same as if it were an external (to the Host) firewire drive.
    •  I don't suppose there is anything I can do to 'put back' lost items from a separate Time Machine drive which has an up to date backup on it.
    There is probably a way to do that - seems to me that's one of the reasons for a Time Machine volume.
    On the other hand, if the Time Machine volume is rigidly linked to the now-absent OS on the original drive, there may be no way to effectively access the files in the TM archive.
    I know that using a cloned drive would work well in this instance.
    I have no experience with Time Machine, so perhaps someone who has will chime in with suggestions.
    With the machine in TDM with the other machine, have you tried running Disk Utility to see if you can effect repairs to the drive?

  • Why am I having update problems again?

    When I started Muse today I received a message that there was a new update and did I want to install. I said yes and it proceeded, when complete I received this pop up message:
    Title,  Adobe AIR -  "Intial content could not be loaded for this application. Try re-installing or contacting the publisher for assistance".
    But you can't re-install because it shows it's already installed. This happen to me a month ago and I had to un-install Muse & reboot before I could re-install.
    Why is this happening? Is there a way I could open up Muse without going through a un-install again. This only happens with Muse updates which occur when starting Muse, other Adobe updates that take place through the Creative Cloud control panel are fine.
    I just tried again, same problem

    Help Again.
    My computer just doesn't like Muse & apparently CC programs. After all this time when starting Muse I have been ignoring the message to update because I'm afraid if I say yes I will have the above problem again. Today I got brave and said yes and Muse would not open again!
    So I returned to this site and used the link you gave me before to reinstall Muse, when it finished it told me that there was a newer version 7.4 available and would I like to install it and I said yes, and it seemed to work and opens fine.
    I also had a request to install the latest update of Creative Cloud so I said yes. Everything went fine. I got really brave and I noticed that there was a newer version of Muse CC 2014 and I installed it but now that CC and other CC programs tell me I need a sign in with my adobe ID to try a 30 trial, if I press the License This Software button it asks me for a Serial Number. Why can't I open CC programs without a serial number, I am a Creative Cloud member? I have 2 Icons on my desktop, Adobe Muse.exe which works and Adobe Muse CC that tells me I need a serial number.

  • My Iphone Has a Restart Problem Again and Again wot To do?

    MY Iphone Has a restart problem again and again wot to do please tell me

    Basics from the user guide are restart, reset, restore from backup, restore as new.  If you go through ALL of those steps and you still have issues, you need to get your phone checked out by Apple.

  • A dns problem again?

    I sent email to [email protected] but the engineer there said he did not receive it. Also, I did not receive the email he sent to me through his sun.com email. it sounds a dns problem again.
    I have changed our mx record to:
    @ IN MX junk.domain.com.
    before, it was:
    @ IN MX junk ==>would this cause dns problems?
    Here is the entry in the mail.log which seemed that sun has received my email successfully:
    09-Dec-2005 09:39:10.59 tcp_local D 2 [email protected] rfc822;[email protected] [email protected] dns;btmx1.sun.com (relay1.sun.com [IntraStore TurboSendmail] ESMTP Service ready) smtp;250 recipient <[email protected]> OK

    Your log shows that Sun did indeed receive your mail.
    Sun's mail infrastructure has been under DOS attack for some days. Sometimes that's caused delays of up to several hours for inbound mail to get to us.
    We also have had some virus infected systems pounding our servers. More delays.
    We do contract with an external company to scan for spam/virus scanning. Those folk historically have lost us some mails, too.
    Your MX record isn't likely to make any difference in you sending out mail, but in your ability to receive mails, yes.

  • Performance Problem Again

    Hi all,
    We are encountering performance problem again
    The batch process deletes 1M rows every night which took 30mins the usual.
    But last night (12AM) it took more that 2hrs and hangs.
    Does it help if I run gather_schena stats regularly when there is constant DELETE on the table?
    Please help me check our ASH, AWR, ADDM to resolve the issue.
    ADDM
    https://app.box.com/s/7o734e70aa2m2zg087hf
    ASH
    https://app.box.com/s/xadlxfk0r5y7jvtxfsz7
    AWR
    https://app.box.com/s/x8ordka2gcc6ibxatvld
    Thanks....
    zxy

    Hi ARM,
    ***What is the SGA_TARGET or MEMORY_TARGET that the database is running on?
    Our server has 8Gb Physical Memory and 8Gb Swap.
    What  is the ideal SGA_TARGET and MEMORY_TARGET shouldbe?
    Our current setting is:
    ========
    SQL> show parameter memory
    NAME                                 TYPE        VALUE
    hi_shared_memory_address             integer     0
    memory_max_target                        big integer 5936M
    memory_target                                big integer 5936M
    shared_memory_address                 integer     0
    SQL> show parameter sga_
    NAME                                 TYPE        VALUE
    sga_max_size                         big integer 5936M
    sga_target                               big integer 0
    Thanks

  • Post Moved BT Problems Again

    Post moved to infinity board http://community.bt.com/t5/BT-Infinity/BT-Problems-Again/td-p/544347
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

    I was going to put it in the Infinity forum but as there were other similarish ones here, and that my problem is reagrding a connection issue (my modem gets Inifinity just fine), I thought thought the connection issues forum would be the correct place.
    Also as HH3 is not Infinity specific, I thought the problem was not necessarily Inifinity specific either
    Even so, thanks for putting in the correct place.

  • Problem again with flickering and no firmware update

    I've got the problem again....
    I think I'll leave Imac world ....

    I had the flickering problem with my new iMac, it was resolved with the new software update to 10.4.6.

  • Replace a substring inside a string, problem

    Hi
    I've a little and simple problem but I couldn't found a solution.
    My program is reading a file by lines, sometimes it receives a line like:
    03-05-26                                               Page: 1and that reprensents a date when doc was generated (left of line) and the page number (right of line). Sometimes, before date it receive an strange char (I guess it's a \r or a \n).
    Well I need to convert date from this US style to ES style (dd-MM-yy format) and then print the line as it was received.
    I know how to change date, but I've problems to parse this line and get an identical line after the process. I'm using split to split tokens and then change the date but when I try to print the line again, I noticed that I lose white spaces between date and page number.
    Also I probed with StringTokenizer with same results.
    I use to program with PHP and there is a strreplace function to do this job easy. How could I do the same with Java ?
    Thanks in advance
    <jl>

    Take a look at String.replaceAll and
    String.replaceFirst. These use regular expression to
    do their pattern matching. They're 1.4 and later
    methods.Thanks.
    I really dont know why I didn't saw it before ask :)
    <jl>

  • Null String and Empty String problem

    Hello everyone,
    since i am totally new in JSP, i am getting problem in handling strings.
    Suppose i have a variable users = ""; then
    I want to ask when to use:
    if (users.equals(""))
    and
    if(users == "")
    in my code, variable users has value "regional" for regional users.
    and i am checking this code as:
    if (users.equals{"regional")) {
    out.print ("I am inside code");
    at that time, the code is throwing error (run time error)
    and when i changed the code as:
    if (users == "regional") {
    out.print ("I am inside code");
    this time, the code is not generating error but the part message "I am inside code " is not displaying. The code do not inserts inside the if condition
    I hope u understand my problem. Can anybody help me out with this.

    This has basically nothing to do with JSP, but with basic Java knowledge.
    When using the '==' operator to compare Objects (yes, String is actually a subclass of Object), then it will look if they are of the same reference. Using the '==' operator to compare primitive datatypes (int, boolean, char, etc) will look if they have the same value.
    That is why the Object class has the equals() method to give the ability compare with another objects. And you can only invoke it when the Object is actually instantiated. So if it is not null.
    if (string != null && string.equals("somevalue")) {
    // or
    if ("somevalue".equals(string)) {
    }should work.
    Edit rym82: this will not throw a NPE, but an ordinary compilation error ;)
    Message was edited by:
    BalusC

  • POI getCellStyle and empty string problem

    I'm having a problem getting the style of a cell from and excel input file and setting to an output file.
    I also have a problem recognizing blank cells that are not null in the input file here is my code any help would be great.
    package Trace;
    import java.io.*;
    import org.apache.poi.hssf.usermodel.*;
    import org.apache.poi.hssf.util.HSSFColor;
    import java.util.StringTokenizer;
    import org.apache.poi.poifs.filesystem.*;
    import java.lang.Runtime;
    public class Converter1 {
         private static short bhyvb= 0;
         private static short foreground, background;
         private static String[][] cellGridOut;
         private static int numRows, numColumns, clock;
         private static POIFSFileSystem fs;
         private static HSSFWorkbook wbin, wbout;
         private static HSSFSheet sheetIn, sheetOut;
         private static HSSFRow rowIn, rowOut;
         private static HSSFCell cellIn, cellIn1, cellOut;
         private static FileOutputStream fileOut = null;
         private static String rowIterator, rowIterator1;
         private static HSSFCellStyle style, style1;
         public static void main(String[] args) {
              //Take in 2 inputs mandatory, Input Event Trace excel file and Time Interval respectively
              if (args.length != 1)System.err.println("Input Excel File"); 
              //Create a new POI file system and HSSF workbook with your excel input file
              InputStream input = Converter.class.getResourceAsStream(args[0]);
              try{
                   fs = new POIFSFileSystem(input);
                   wbin = new HSSFWorkbook(fs);
              }catch (Exception e){System.err.println("File input error");}
              wbout = new HSSFWorkbook();
              sheetIn = wbin.getSheetAt(0);
              numRows = sheetIn.getLastRowNum();//numRows=723
              style = wbout.createCellStyle();
              //style.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
              //style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
              //get number of columns
              rowIn = sheetIn.getRow(0);
              boolean done = false;
              int testNullPointer;
              numColumns=0;
              while(!done){
                   //System.out.println(ColumnInc);
                   cellIn = rowIn.getCell((short)numColumns);
                   numColumns+=1;
                   try{
                        testNullPointer = cellIn.getCellType();
                   }catch(NullPointerException npe){
                        done = true;
              numColumns-=1; //number of columns = 25
              converterIt();
              //Create new output file, if it exists delete it
              File myFile = new File("converted.xls"); 
              if(myFile.exists()){
                   myFile.delete();
              //Create new file output stream
              try {
                   fileOut = new FileOutputStream(myFile);
              } catch (IOException ioe) {}
              //write all conversion data to output file
              try{ 
                   wbout.write(fileOut);
                   fileOut.close();
              }catch (IOException ioe) {} 
         public static void converterIt(){
              boolean nextDone = false;
              boolean nextDone1 = false;
              for(int i=0; i<numColumns; i++){
                   clock =1;
                   rowIn = sheetIn.getRow(0);
                   cellIn = rowIn.getCell((short)i);
                   String getTopRow = cellIn.getStringCellValue();
                   sheetOut = wbout.createSheet(getTopRow+"_s"+i);
                   sheetOut.setColumnWidth((short)0, (short)(13 * 256));
                   sheetOut.setDefaultColumnWidth((short)25);
                   for(int j=0; j<=numRows; j++){
                        if(j==0){
                             rowIn = sheetIn.getRow(j);
                             cellIn = rowIn.getCell((short)i);
                             String temp2 = cellIn.getStringCellValue();
                             rowOut = sheetOut.createRow((short)j);
                             cellOut = rowOut.createCell((short)j);
                             cellOut.setCellValue(temp2);
                             cellOut = rowOut.createCell((short)(j+1));
                             cellOut.setCellValue("CLOCK");
                        if(j==1){
                             rowIn = sheetIn.getRow(j);
                             cellIn = rowIn.getCell((short)i);
                             double temp3 = cellIn.getNumericCellValue();
                             rowOut = sheetOut.createRow((short)j);
                             cellOut = rowOut.createCell((short)0);
                             cellOut.setCellValue(temp3);
                             cellOut = rowOut.createCell((short)1);
                             cellOut.setCellValue("");
                        nextDone=false;
                        nextDone1=false;
                        if(j>1){
                             rowIn = sheetIn.getRow(j);
                             try{
                                  cellIn = rowIn.getCell((short)i);
                             }catch(NullPointerException npe){
                                  rowIterator = "";
                                  nextDone=true;
                             if(!nextDone){
                                  try{
                                       rowIterator = cellIn.getStringCellValue();
                                       style = cellIn.getCellStyle();
                                  }catch(NullPointerException npe){}
                             if(j==2){
                                  rowOut = sheetOut.createRow((short)(clock+1));
                                  cellOut = rowOut.createCell((short)0);
                                  cellOut.setCellValue(rowIterator);
                                  cellOut = rowOut.createCell((short)1);
                                  cellOut.setCellValue(j-1);
                                  clock+=1;
                             }else{
                                  rowIn = sheetIn.getRow(j-1);
                                  try{
                                       cellIn = rowIn.getCell((short)i);
                                  }catch(NullPointerException npe){
                                       rowIterator1 = "";
                                       nextDone1=true;
                                  if(!nextDone){
                                       try{
                                            rowIterator1 = cellIn.getStringCellValue();
                                       }catch(NullPointerException npe){}
                             if(rowIterator1!=rowIterator && j>2){
                                  rowOut = sheetOut.createRow((short)clock+1);
                                  cellOut = rowOut.createCell((short)0);
                                  cellOut.setCellValue(rowIterator);
                                  //System.out.println(style);
                                  cellOut.setCellStyle(style);
                                  cellOut = rowOut.createCell((short)1);
                                  cellOut.setCellValue(j-1);
                                  clock+=1;
                        }//if
                   }//for
              }//for
         }//converterIt
    }//Converter1 CLASSEND

    I am not sure about the cell style as it looks like you are doing it right. For the null or blank cells it looks like you are only checking for null not "".

  • Search and replace string problems

    Hi to all,
    I have problem with Search and replace string function. It shows me a wrong Value (Number) from 15 to 100 is everything OK (15=0, 30=1, 45=2, 100=3), but after 100 ........
    Take look in VI and if you have any ideas post them please
    THX
    Igor 
    Attachments:
    indexing.vi ‏10 KB

    there will be no 15115 string, but 15 or 115 and 15 is 0, 115 is 4. Anyway, i have changed string input format and now its working THX for your help
    Attachments:
    indexing.vi ‏10 KB

Maybe you are looking for

  • Creating a new database in Oracle Database 10g...

    I have downloaded a copy of Oracle Database 10g Express Edition from Oracle's website. I am using Windows XP. I am trying to create an Oracle database that I can connect to from Access 2003 via ODBC. 1. How do I create a new database? I can see optio

  • Source data for Legal and Management Consolidation

    Hi, I'm in ECC5, using BCS 4.0 and BW 3.5. Our current designed required 2 type consolidation, which is company consolidation and profit centre consolidation. Note that the profit centre consolidation also required balance sheet and profit/loss. Now,

  • How to create Matrix report in 9iAS portal

    Could u pls explain with an example how to create an Matrix Report using Web Portal wizard bcos I need to create many complex reports with user parameters where I am not getting flexibility in WebDb to create such reports. Thank you

  • Firefox 13.0.1 will not start up in Windows 7 Home Premium.

    Reinstalling did not help, it doesnt create a window or a windows process in task manager. When i start it up, next to the pointer comes a loading circle but that stops and nothing happens.

  • Zram fails to start [SOLVED]

    I installed zramswap in AUR and then activate with # systemctl enable zramswap I restart and not works: ● zramswap.service - Zram-based swap (compressed RAM block devices) Loaded: loaded (/usr/lib/systemd/system/zramswap.service; disabled) Active: fa