Help! Problem with using variables/objects

I am writing a method that will create a new object based on a class. Obviously, the following code works:
Line victoria = new Line("Test");
But now I want to be able to put any string I like where victoria is. Something along the lines of:
public void createNewObject(String newObjectName)
Line newObjectName = new Line("Test");
But this won't work because it says I have already named newObjectName.
How can I get it use the value contained WITHIN the string rather than the string itself?
Thank you in advance,
G

Yes. The method signature declares a variable
newObjectName of type String whose scope is the entire
method. So you can't declare another variable with the
same name within the method, as you attempt to do. I
think you want to replace Line newObjectName =
new Line("Test"); with Line newObject =
new Line(newObjectName);Then you'll need to
think about how to make the new object available to
the code which called the method...YATArchivist, thank you for the reply but I don't think it solves the problem.
Your solutions passed the string into the creation of the object but the object name is still static. This mean that if I create another object it will still have the name newObjectName.
Maybe I am approaching the problem incorrectly. Imagine I had a class called Book. If I had a library program and wanted to create more than one book based on the class Book, how could I do it?
Please help me!!!
Thank you,
G

Similar Messages

  • Problem with using Outputstream object

    hello
    I am getting images from a database as byte.
    But when I try to display them in jsf environment, I get exception.
    Here is my code about the problem :
    while (rs.next()) {
         imgBytes = rs.getBytes(1);
    OutputStream out=null;
    out.write(imgBytes); // this is problamatic
    out.close();
    I will appreciate, if you tell me what might be wrong ?
    regards
    Ahmet Temiz

    orkun wrote:
    OutputStream out=null;
    out.write(imgBytes); // this is problamaticnull, does not know how to write.
    If you want to put them out to stdout, then System.out.println(imgBytes);

  • I am going to buy unlocked iphone 5.. i will be going to india nxt months and will stay there for a while... so my question is will i get warrenty in india.. and will there be any problem with using indian sims..?? thnx for the help..

    i am going to buy unlocked iphone 5.. i will be going to india nxt months and will stay there for a while... so my question is will i get warrenty in india.. and will there be any problem with using indian sims..?? thnx for the help..

    The warranty for the iPhone is not and has never been International.
    Warranty and support are ONLY valid in the country of origin.  The only exception is the EU where the entire EU is treated as one country.
    If the device will be used in India, buy it in India.
    An unlocked iPhone will work on any supported GSM carrier world wide.  The LTE portion of a US purchased, unlocked iPhone is unlikely to work outside North America as it does not support the appropriate bands used in other countries.

  • Problem with Copied Business Object : SELFITEM

    Hi,
    sub:    Problem with Copied Business Object : SELFITEM
    I want to use changed selfitem BOR for carbon copy functionality. For it, i copied the BOR : SELFITEM. it is giving error
    In SWI2_DIAG it is showing like this.
    Work item  cannot be read                                                
    Work item 000000639770: Object  method SWW_BI_EXECUTE_S cannot be executed
    The problem is with COPYING The Business Object. Because , generally we extend BOR ,not copy. But i did copy.
    Please help me regarding this.
    Balaji.T.

    hi Martin,
    The problem may not be in method. because simply we copied the BO:SELFITEM into ZSELF . And i want to test this for a mail at first , whether copied BOR  is working or not.The mail is not triggering . it is saying that it is Error.
    WF_BATCH error...
    I can see error in Tx: SWI2_DIAG ,
    this is Error :
    Work item 000000639770: Object  method SWW_BI_EXECUTE_S cannot be executed
    Once it is rectified i can modify the method in BO:ZSELF.
    Thank you in Advance..
    Balaji.T.

  • TPC 2012 - Problems with shared variable

    Hi,
    I tried to program simmilar thing to this one http://zone.ni.com/devzone/cda/tut/p/id/5548 on TPC 2012. But it doesn't work.I can see that both programs on my laptop and TPC are working(I've added an additional counter with display), but I cannot see any effect on TPC when I change the value of shared variable on my laptop. I use LabView 8.6 with Touch Panel Module. My question is what are the exact steps to run such application on TPC2012? Are they the same as for TPC 2006?
    I've noticed following issues:
    1.I cannot deploy the program from Project Manager(there is an information that maybe TPC Service is not started. - I've found such information about TPC Service http://digital.ni.com/public.nsf/allkb/DE177828D27A14A48625734E00768B66 but in fact I cannot find Start » All Programs»National Instruments » NI TPC Service » NI TPC Service Manager 1.0 Does it mean, that the TPC Service is not installed and the programm with shared varibles won't be working or can I start it somehow in another way? Do I need to have TPC service installed on TPC2012?
    Until now, I've built the project and sent it through FTP to TPC(the folder was /TEMP) and then started it.
    2.Ping works OK
    Thank you in advance for any hints how to solve this problem.
    Martin

    Well no problem, but I'm frustrated with this issue... I've tested many things and nothing. Just to help someone else as I in the future, these are my sources:
    http://forums.ni.com/t5/LabVIEW/TPC-2012-Problems-with-shared-variable/m-p/1009631/highlight/false#M...
    http://digital.ni.com/public.nsf/allkb/28536DE7E2D9E98B8625770B00738920?OpenDocument
    http://zone.ni.com/reference/en-XX/help/372507B-01/lvtpcgsm/tpc_install_sharvar/
    http://zone.ni.com/reference/en-XX/help/372507C-01/lvtpcgsm/tpc_install_sharvar/
    http://digital.ni.com/public.nsf/allkb/23532363F4905EC28625727A00730B80?OpenDocument
    http://forums.ni.com/t5/FieldPoint-Family/TPC-2006-Not-Listed-in-Targets-and-Devices/td-p/566325
    http://forums.ni.com/t5/LabVIEW/MAX-can-t-detect-TPC-2106T/td-p/831524
    http://zone.ni.com/devzone/cda/tut/p/id/5868
    http://digital.ni.com/public.nsf/websearch/28B748B9697B79E18625725A00009066?OpenDocument
    http://digital.ni.com/public.nsf/websearch/D1726990DCEB82E4862570F20069C57D?OpenDocument
    http://digital.ni.com/public.nsf/allkb/3B469103BBDD4CE48625726000665B36
    I hope find some hint..
    Fabian León
    Certified LabVIEW Associate Developer

  • Problem with formula variable

    HI,
    I am facing problem with formula variable with replacement path. my requirement is system date - posting date.
    here i created 2 formula variable one is system date. second formula vaiable with replacement path is posting date. second formula vaiable not populating data. please help on that.
    regards,
    kris

    Hi,
    here is some idea.. here i have taken expample dates 1)notification creation date and 2) notification completion.
    1st:in the query designer at key figure coloumn create
    one local formula.in that local formula create formula
    variable with replacement path.in that take reference character
    notification completion.in the next tab take replace ment
    as key.in the last tab select "date".
    2nd: do the same thing for the notification creation date.
    3 rd : create 3 rd local formula and do the substraction
    for the first 2 local formulas.
    4th:create codition on the difference which u have find with
    on that condition u can create one user entry varibale.
    5th:while u defining the query put these 2 dates,i,e
    notification completion, notification creation date in the character block.
    If not system will ignore the formula variable which u created in
    above steps.
    Hope this wil help u.
    regards....KP

  • Problem with database schema objects in the entity object wizard

    Hi All,
    When creating a new entity object, I am facing a problem with database schema objects in the entity object wizard, database schema objects (check boxes for tables,synonyms...) are disabled. Actually I am using a synonym but I am not able to select the synonym check box.
    Can any of you folks tell me how to enable the database schema objects (check boxes for tables,synonyms...).
    Thanks in Advance.
    Raja.M

    Make sure your using rite version of jdeveloper..
    Make sure your using apps schema and check whether your able perform DML operations in the schema vis sql developer.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                           

  • AxWindowsMediaPlayer problem with using subtitle sami.file in winform

    Hello every body
    I have a problem with using sami caption in axWindowsMediaPlayer;
    how can I use it?
    I used
    axWindowsMediaPlayer1.closedCaption.SAMIFileName="FileNameAddress";
    and
    axWindowsMediaPlayer1.ShowPropertyPages();//and select sami file
    but in both ways the subtitle is not shown in my axWindowsMediaPlayer1 control;
    please help me for solving this problem

    Hi ,
    As i know the Synchronized Accessible Media Interchange (SAMI) file must use an .smi or .sami file name extension.
    set the smi-file direclty like following
    AxWindowsMediaPlayer.closedCaption.SAMIFileName = "subtitles.smi";
    Please also refer here
    for more details.
    Follow the steps below for your Windows Media Player to display captions and subtitles.
    http://support.3playmedia.com/entries/21934486-windows-media-files-windows-media-player-settings
    Related thread, please note the Style secttion.
    http://answers.microsoft.com/en-us/windows/forum/windows_7-pictures/wmp-12-doesnt-play-sami-files-closed-captions/96fe98b7-1cdf-41f5-aa9e-a4e55fd07c0a
    In addition, Could you please provide your smi or sami file and full code? It could be better to help us do some test on my side.
    Have a nice day!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I am having problem with using the Basic brush definition

    I am having problem with using the Basic brush definition. When I try to click on it will not allow me to use it and will automatically use the 5 pt. oval brush definition. The only way I can use the basic brush is after I have already drawn something and then I have to click on the stroke and then press basic. This is incredibly annoying and if anyone could help I would greatly appreciate it. (I have Adobe CS6)

    for whatever reason, the basic 'brush' you see in the brushes palette effectively means removing any brush from a path. to draw with the brush tool you need a brush defined. in your case the last one selected being the 5 pt oval one.

  • I am having problem with using my Basic brush definition

    I am having problem with using the Basic brush definition. When I try to click on it will not allow me to use it and will automatically use the 5 pt. oval brush definition. The only way I can use the basic brush is after I have already drawn something and then I have to click on the stroke and then press basic. This is incredibly annoying and if anyone could help I would greatly appreciate it. (I have Adobe CS6)

    Basic is not a brush, only a starting point for you to make a brush. Load the real brush you want before beginning to draw.

  • I have a problem with using MacBook Pro as wifi router when connected to ethernet

    I have a problem with using MacBook Pro as wifi router when connected to ethernet. The Airport icon changes to show a laptop inside, my iPad shows connected (I think) but Safari will not operate. I tried pinging my iPad, it seems to see the iPad, but no connection to Safari or to other apps such as Good on the iPad. I have read many posting and tried repeatedly via Sharing in Systems Preferences, but no luck. Suggestions to fix, or is this a Lion problem?

    Usually this is a problem related to the domain name server address. If you open Network preferences, select your Ethernet port then click on the Advanced button then on the DNS tab. You will likely see an entry like 10.0.1.1 already listed. Click on the Add [-] button and enter 208.67.222.222 then click on the OK button and then on the Apply button.  See if this helps.
    if it does not help then repeat the above but with the Airport port.

  • I have a problem with using (hotmail)

    i have a problem with using (hotmail) , that when i try to use messenger through it , that shown many of pages can not be open , and my contacts are not available , when i contact with Windows Live team to solve the problem they inform me that the problem is with my browser , so i have to ask them about it , and i use Mozilla Firefox 8.0 , so kindly help me to solve this issue

    That is a problem with Silverlight
    On a Mac, Firefox 4 is a 64 bit application.<br />
    Not all plugins support 64 bit and if not then you need to start Firefox in 32 bit mode to use that plugin.
    # Close Firefox
    # Start the Finder and open the Applications folder
    # Right click or control-click the Firefox.app icon
    # Select "Get Info"
    # Select or Deselect "Open in 32-bit mode"
    # Close the "Firefox Info" window
    # Restart Firefox

  • Problem with environment variables

    JAVA_HOME = C:\JBuilder9\jdk1.4
    Path = C:\oracle\product\10.1.0\Db_1\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin\client;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;.;C:\oracle1\product\10.1.0\Db_3\jdbc\lib\classes12.zip
    When I run foo.java I get this error, which i believe is because of some kind
    of problem with environment variables.
    Exception in thread "main" java.lang.NoClassDefFoundError: OraThinI eliminated this path
    C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin
    just to check whether two paths of jdk bin folder is causing problem but I see no change.
    Please help

    I had solved it myself
    I am a genious :P
    Just do this
    JAVA_HOME = C:\JBuilder9\jdk1.4
    CLASSPATH = C:\oracle\product\10.1.0\Db_1\jdbc\lib\classes12.zip;.;%JAVA_HOME%\bin
    PATH= C:\oracle\product\10.1.0\Db_1\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin\client;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;.;C:\oracle1\product\10.1.0\Db_3\jdbc\lib\classes12.zip;%JAVA_HOME%\bin

  • I have two Iphones with different email addresses sharing one Apple ID. Will that cause problems with using messaging and FaceTime?

    I have two Iphones 5 with different email addresses sharing one Apple ID account.Both are using IOS 8.
    I would like to set up a new Apple Id for one of the phones and remove it from the old account.
    If I do that, can I move all of the purchased apps and songs to the new Apple account?
    Also, will sharing one Apple ID account with two devices cause problems with using messaging and FaceTime?

    Sharing an iCloud account between two devices can be done without causing issues with iMessage and FaceTime, just go into Settings for each of these functions and designate separate points of contact (i.e. phone number only, or phone number and unique email address).  While that works, you'll then face the problem where a phone call to one iPhone will ring both if on the same Wi-Fi network -- but again, that can be avoided by changing each phone's settings.
    Rather than do all that, don't fight it -- use separate IDs for iCloud.  You can still use a common ID for iTunes purchases (the ID for purchases and iCloud do not have to be the same) or you can use Family Sharing to share purchases from a primary Apple account.

  • I purchased Adobe Creative Suite C2 and have been using it for years on the same computer no problem with using it. Recently upon opening Photoshop I received a pop up window saying due to Adobe Software security we need you to activate your CS2 software.

    I purchased Adobe Creative Suite C2 and have been using it for years on the same computer without any problems with using it. Recently upon opening Photoshop I received a pop up window saying due to Adobe Software security we need you to activate your CS2 software. I tried, phone activation, web activation, nothing is working. I have the serial number and my Adobe account information. Any suggestions?

    Error: Activation Server Unavailable | CS2, Acrobat 7, Audition 3
    Mylenium

Maybe you are looking for

  • Object Link to Contracts

    Is it possible to create an Object Link in a DIR to a Contract?  I configured my document type in dc10 to have an object link to /BEV3/CHWV (Contract Handl. Doc.)  However, when i go to cv01n, create a new DIR and try to link it to a contract, I get

  • Single payment method with two house banks

    Hi, I have scenario of single payment method 'C' (cheque) & two house bank viz. hdfc & icici having ranking order 1 & 2 respectively. Now i want to make payment from icici bank having ranking order 2, but system is picking hdfc bank because of having

  • How to specify path to read E$ tab records into .xls file using odisqlunlod

    Hi Can any one help me how to specify specific path in odisqlunload tools which is useful for both windows and linux. I am developing and testing in windows and moving generated scenario into linux box to test for testing people If in case any error

  • Bug with editing Appointments

    Hello, we experience a strange behaviour for one of our users, unfortunately a CEO. Our Client version is 12.0.2 at the moment. With GW 2012 the "resend" context option for appointmens has been replaced by the new "edit" option. The problem is that t

  • I am really touched to see Air 2.6... but dear Adobe...

    Question #1 This 2.6 brought so many amazing features into packager, it will be really cool if Adobe can hint about it earlier! Can Adobe shares with all the fans what are their roadmaps or priorities when they are improving the product? No obligatio