Subroutines changing variables

why does the method on the left not change the value of x? i just can't see why it wouldnt!?!
for the code.....
void dontChange(int z) {              void change(Student s) {
         z = 42;                                s.name = "Fred";
     The lines:                            The lines:
        x = 17;                               stu.name = "Jane";
        dontChange(x);                        change(stu);
        System.out.println(x);                System.out.println(stu.name);
     output the value 17.                  output the value "Fred".
     The value of x is not                 The value of stu is not
     changed by the subroutine,            changed, but stu.name is.
     which is equivalent to                This is equivalent to
        z = x;                                s = stu;
        z = 42;                               s.name = "Fred";

z=x means that the value of x is assigned to the
variable z
z=42 means the the value of 42 is assigned to the
variable z
in order to change x, you have to assign adifferent
value to it like
x=987
this was not done in the code.Becareful of what you say. In the following (slightly
altered code) the output will still be 17.
public static void dontChange(int x) {
x = 42;
public static void main(String[] args) {
int x = 17;
dontChange(x);
System.out.println(x);
be careful of what you say, in the method dontChange(int x)
x is a method variable and it's scope is the method.
please test it

Similar Messages

  • BEx Analyzer Not showing report result in canceling "Change variable Icon"

    Hi Experts,
    Do we have any settings in BEx Analyzer for retrive the Result set even after I click 'Change variable Icon' in Toolbar and cancel the variable pop-up window??
    Eg: My query Result is displayed in Analyzer selecting some vaues in Selection screen.And when I click the Change Variable Icon from 'Analyzer Toolbar' its showing me 'Select values for variable' window.If I select the cancel button in it, then Query result becom blank showing the message "There are variables; change variable values". Do Analyzer having an option or settings to keep the result even if i cancel the variable selection from "change variable icon".
    Thanx in advance..

    Sari-
    If SAP provides such a function, I have not found it. The way I understand it., the change variable value initiates the OLAP back end. This clears the Presentation Manager front end, and clears the 'results' that are displayed on your workbook. If you cancel the OLAP run, the front end clear still executes.
    HOWEVER... if you turn OFF Automatic Refresh before clicking on Change Variable Values and then clicking on Cancel, the presentation manager will not write any changes to your workbook. So that is your best solution.

  • Change variable from negative to postive

    hallow
    i wont top now how i change variable from negative  to postive
    like change -5 to 5
    thankes

    Hi Shnya,
    You just multiply with " -1", it wil get converted from Positive to negative or vice versa.
    Hope I answered your query.
    Regards,
    Sujatha

  • How to define a changing variable in Broadcasting.

    I would like to run bex web report in background using information broadcasting in bw 3.5. I setup all required settings and it is running fine. But I would want the broadcaster should take changing variable (example: date or fiscal period etc) based on the execution date or other condition. (please note that this is not for including date and  time etc in description).
    I want broadcaster should take current date  or date range or fiscal period as variable (selection screen) while running the report. I have tried using filter variable tab in broadcaster. But it was taking only static dates.
    pls suggest.
    Thanks in advance.

    Could you please tell me in detail. Which user exit variable you have mentioned? I am already using user exits (code in CMOD) for variables in query and it is working fine.
    Now, I want to run the same query in background using information broadcasting. When i run the query it asks for user input (for example: date etc). I enter the current date and execute the report. But I dont want to enter current date each time. Instead i want to execute them in backgroun and system should take values by itself.
    Correct me if I am wrong. For this you suggested me write one more user variable where it will populate variable values for backgroun (not used in query)? pls reply.
    Thanks, points assigned.

  • Format for Predefined lists of repeated measurements with changing variables

    Hi,
    I am a scientist and trying to draw an instrument ("writing a script" sounded wrong for LabView ) that is supposed to perform repeated measurements in an imaging experiment.
    I want to be able to give the instrument a list that defines the values for several variables for each repetition, because I want it to do different things in different episodes of the experiments and/or alternate different acquisition methods. In this way I can use the same script for a wide range of experimental paradigms.
    I am trying to decide on the format in which I could write the sequence to LabView to read. I looked into XML, but the LabView scheme seems pretty useless. If I use a textfile I would have to program a parseing script myself. If I use binary files I need to program an editor.
    I also thought about whether I want a line by line execution protocoll or just changing variables and leaving the execution protocoll integrated in the instrument. However, the latter would reduce the versatility.
    What would you think is a good way to do it?
    In general each measurement consists of:
    0. wait for a defined time (always the same)
    1. light on (different light sources)
    2. acquire images (different durations, exposure times, frames numbers)
    3. trigger a device (not in all repetitions, maybe changing devices in future)
    4. turn on a channel (changing channels)
    5. acquire images (different durations, exposure times, frames numbers - also different from step 2)
    6. turn off the channel (same as in 4)
    7. acquire images (different durations, exposure times, frames numbers - also different from step 2 and 5)
    8. light off (same source as 1)
    So there is basically a repetitive pattern. The image acquitisition 'epics' are performed by the same device, everything else is switching on and off channels of a NI PCI.
    Dennis
    P.S. I use LabView 2009

    I'm in agreement that your best bet would be a simple CSV or tab delimited file.  You can edit these in Excel, which makes the writing a lot easier.  There is the Read Spreadsheet File VI which can give you a 2D array for your steps and parameters.
    So, to keep it simple, use a csv.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Change variable type during program flow

    Hi there. Please tell me is there a possibility in ABAP to change variable type during program flow? I'd be very thanful for suggestions. Greetings.

    hi,
       Make use of field symbols for that ...
    field-symbols : <fs> type any.

  • To Run GPS by changing variable in UPSPL transaction automatically??

    Can somebody tell me if it is possible through an ABAP code to run global Plannig Sequence by changing variable value automatically by just a single click of button. (for eg. If i have a variable which can be given 5 different values, and i want to run a Global Planning Sequence for each variable value. Then can i write a ABAP code so that on just a single click of botton this is possible.) It would be helpful if somebody can send me a demo code also. My email id is [email protected]
    Regards
    Rishi

    Hi Rishi,
    To Answer, How to run GPS through ABAP code -
    i do not know a planning function to run a GPS, but i have written an ABAP code thought with i'm executing 3 planning functions one after another using function module UPC_FUNCEXE.
    CALL FUNCTION 'UPC_FUNCEXEC'
      EXPORTING
        I_AREA                =
        I_PLEVEL              =
        I_PACKAGE             =
        I_METHOD              =
        I_PARAM               =
    IMPORTING
      ET_LOG                =
      E_ERROR_OCCURED       =
    you can call this function module multiple time in your ABAP code. it will work same as a Global Planning Sequence.
    Can you explain more about how do you want to execute a planning sequence on the change of variable value.
    Regards
    Tarun

  • How to change variable values ?

    Dear friends,
    How to change variable values when we are broadcasting the Queires ?
    Do we need to change them everytime ?
    Thanks,
    N

    Hi,
    Please go through it.
    /people/ramkumar.ghattamaneni/blog/2008/02/25/using-variables-while-broadcasting-queries-to-the-portal-in-bi-7
    Regards,
    Ramkumar.

  • BEx crashes when changing variable values

    Hi all,
    We're having a problem with BEx.
    It crashes when trying to change variable values.
    We've been looking into syslogs and dev logs and so on,
    and found that the cpic connection has been disconnected
    before the crash. BUT we cannnot find out what is actually
    disconnecting the session.
    Well, at least F/W wasn' the cause. Have check the logs.
    Any ideas? Thx in advance!
    Yuko
    Below is our info.
    BEx: BI 7.10 sp7
    BI: BI 7.0 SAPKW70017
    <BI syslog at the time of BEx crash>
    15:40:36 RD                                 Q0  I Operating system call recv failed (error no. 232 )
    15:40:36 RD                                 S2  3 Connection to CPI-C client 586 was closed
    15:40:36 RD                                 S7  4 > Partner LU name:
    15:40:36 RD                                 S0  R > Host: 172.19.xx.xxx
    15:40:36 RD                                 S0  I > Partner TP Name: EXCEL
    15:40:36 DIA  000 500 BIB103                R4  9 Communication error, CPIC return code 020, SAP return code 223
    15:40:36 DIA  000 500 BIB103                R5  A > Conversation ID: 82142217
    15:40:36 DIA  000 500 BIB103                R6  4 > CPI-C function: CMSEND(SAP)
    <dev_rd log trace level 3>
    GWRD LOOP **********
    I'm in GwReceive
    SiSelPSelect: start select (timeout=20000)
    Thu Apr  9 15:40:36 2009
    SiSelPNext: an error occurred in sock 31
    NiSelISelectInt: error detected on hdl 18 / sock 31
    NiSelIListInsert: add hdl 18 [17] to sel-list (0) of set0
    NiSelISelectInt: 1 handles selected (0 buffered)
    main: NiSelNext (ni_hdl=18, read=1, write=0, connect=0, hdl_info=0x6000000000587400)
    request from CLIENT
    GwRequest: request from client 586
    GwGetMemory: allocated 0x600000000089bee0 (len=34615)
    NiHsLGetHostName: found address 172.19.xx.xxx in cache
    ***LOG Q0I=> NiIRead: recv (232: Connection reset by peer) [nixxi.cpp 4423]
    ERROR => NiIRead: SiRecv failed for hdl 18 / sock 31
        (SI_ECONN_BROKEN/232; I4; ST; 172.19.xx.xxx:1097) [nixxi.cpp    4423]
    Adresse   Offset  bad request
    GwSaveErrInfo2: save err info (225)
    ***LOG S23=> GwIDisconnectClient, client disconnected (586) [gwxxrd.c     11657]
    ***LOG S74=> GwIDisconnectClient, client disconnected ( SY08472) [gwxxrd.c     11665]
    ***LOG S0R=> GwIDisconnectClient, client disconnected () [gwxxrd.c     11704]
    ***LOG S0I=> GwIDisconnectClient, client disconnected ( EXCEL) [gwxxrd.c     11713]
    LOCATION    SAP-Gateway on host mxxx112 / sapgw01
    ERROR       connection to partner '172.19.xx.xxx:1097' broken
    TIME        Thu Apr  9 15:40:36 2009
    RELEASE     700
    COMPONENT   NI (network interface)
    VERSION     38
    RC          -6
    MODULE      nixxi.cpp
    LINE        4423
    DETAIL      NiIRead
    SYSTEM CALL recv
    ERRNO       232
    ERRNO TEXT  Connection reset by peer
    COUNTER     790

    Just FYI.
    After all, we ended up applying BEx addon patch 9.
    The problem about the BEx crash seemed to be fixed in patch 8, but another problem (I heard it was about something to do with report jump function) was not fixed. As a result, we skipped patch 8 and applied 9.
    Both problems were fixed in patch 9.
    Many thanks to SDN informations.
    Yuko

  • How can I display a changing variable in a subvi on the front panel of the main vi as the subvi is excuting

    In the document attached the vi on the right is sub to the vi on the left. On the subvi on the right the variable "Field Reading" is continuously updated on the front panel of the subvi as the "for" loop is executed, but only the last value of the variable is updated on the main vi front panel which is what is expected. My question is how can I display the changing value of "Field Reading" on the main vi front panel as the "for" loop in the subvi is running?
    Thank you.
    Solved!
    Go to Solution.
    Attachments:
    Doc2.docx ‏554 KB

    Hopefully I can explain it well enough. It really is simple.
    1) Create an empty global variable and call it something like User Interface References.vi
    2) For each and every control and indicator on your front panel, right-click and select Create/Reference
    3) Place these references wherever you like (I use a series of Event cases to perform my initialisation and these all live in one of these event cases). They can be placed anywhere in the main vi.
    4) For each of the references, right-click and select Create/Indicator
    5) Moving to the front panel, Cut all the indicators and Paste them in the global variable (eg. User Interface References.vi)
    6) Moving back to the block diagram, wire the global variable to each of the references and select the same named global variable.
    All the hard work is now done (until you add another user interface terminal). You should now have something that look as shown below, [except the reference labels would be to the left (not sure why the snippet put them above)]. In my latest program I have 82 references!
    Done. You can now access all your front panel controls and indicators anywhere in your program as shown below.
    You can just select Value in most cases, but in this particular case I wanted to fire off an Event to do some things (log the alarm) as well as just update the value. So, this is another bonus with the method.
    Hopefully this all makes sense. If not, let me know.

  • Applet error with changing variable data after several runs....

    Can anyone give some advice on the following:
    I have a java card program running on a gsm sim:
    The program makes use of member variables which
    contain data that is reused and rewritten all the time.
    The member variables are all declared as (for example)
    private byte[] myVariable = {(byte) ' ',(byte) ' '};
    And the values stored in the variables are changed
    everytime the program gets an event. This works fine
    for about 15 - 35 times and then suddenly the program
    can't execute any code that accesses these variables (the
    other parts that simply display a message or the menu and that
    never change their variable's value have no problem running on).
    Does anyone know a specific reason for this ? Should I rather
    use my own EF entries on the SIM to keep data ? Is there any
    specific rules around using variables and reusing them ?
    The only fix (once this occurs) seems to be to reload the applet
    onto the card...resetting the phone etc. does not change this
    behaviour....
    Any help would be much appreciated...

    I don't think that your problem lies in your private member variable.
    From my point of view it is more likely that you some kind of memory allocation problem somewhere.
    Anyway it is always a good idea to post a minimal applet which reproduces the erroneous behaviour.

  • How to change variable values dynamicly  in broadcasting

    Dear Friends i am scheduling workbooks using broadcasting feature.
    i want to know how can i change the variable values of report in broadcasting dynamically.
    becuase i dont want to schedule report again and again after changing the variable values.
    Regards
    Malik

    i did the same but its not working.
    i create one variant for the query ABC  using RSRT now if i look into table RSRVARIANT we can see that variant
    entry in this table. Now i create variant by bex on this query with the same name.
    now i schedule it using broadcasting but its not takeing the values of RSRVARIANT table.
    Its taking the value of variant which i save in bex.
    By default variant which is save in bex not appear in RSRVARIANT table.
    But i f you make a variant in RSRT you can see those entries in Table RSRVARIANT.
    But RSRT variant is not showing in Broadcast scheduling. Only Bex variant are showing.
    Where should create the variant in Workbook, in Bex web analyzer, or in RSRT.
    Regards
    Malik
    Edited by: Malik Naeem on Jun 9, 2010 2:05 PM

  • Change variable values in a class without acessing it's methods?

    I have the following scenery, a main class with:
    -ArrayList of strings.
    -Class frame (with textfield and button) supposed to add strings to that Array.
    Ok, in main class i set the frame to run, but how to make the frame to change the ArrayList of the main class in a easy way? What is the easiest solution and the best without hurting the paradigm?
    1-One solution would be to make a method in frame that returns the string and IN MAIN CLASS add it. But is this too straightforward? Like, if i had to manage 7,8 frames that must acess 7, 8 ArrayLists of main class as well as other frames recursively (Example: main class start running frame 1, then if button1 pressed go to frame 2, if button 2 pressed get textfield and chang ArrayList)
    2-Another solution would be to set all ArrayLists as static variables so i can change them freely? Is this a good paradigm?
    3-Pass the own main class as parameter throughout the frames? Is it possible? If so please post a 10, 15 line code in which i could do that.
    4- Put the main class as mother and all frames as son and put all arraylists as protected?
    I feel like im lacking one good paradigm, it should exist some concept in which the created object could change the value of the variable passed as parameter in the class that created it.
    Thank you very much.

    Thank you for your reply Kayaman, but i think you should help me.
    I tried to pass a simple variable (a string) as parameter through the constructor to one frame, like any other class.
    public class TelaLogin extends javax.swing.JFrame {
    String a;
    public TelaLogin(String a) {
    this.a=a;
    initComponents();
    But it returns a compilation error, maybe is something in it's main method? I didn't change it:
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new TelaLogin().setVisible(true);
    The main class has a 'new TelaLogin' that looks very suspicious. Is it that?
    This looks very simple.
    What must i change here? Please Kayaman help me.

  • Changing variable values in query navigation

    Hello,
    We used to use the functionality of a user exit variable for a web template query and could enter a default value for a query, like yesterday's date. This allowed the web template to be presented without a user having to enter variables in order to initially see data. Then either dropdowns or the navigation block objects could be used to navigate the query. To do this the, "Can be changed in query navigation", was set to on. In BI 7.0 this functionality has been removed. Is there a way to provide a default value to a characteristic that can still be changed during query navigation?
    According to documentation this functionality has been enhanced with default values in the variables but there does not seem to be a way to enter a non-fixed value and still change it during navigation.
    Any assistance would be appreciated.
    Thanks,
    Rick

    This can be done by changing the variable to be processed with user exits and changing the user exit for variables to populate the variable value at runtime.

  • Cannot change variable for key date in aggregate

    Hello,
    when I drag time-dependant attributes into an aggregates definition I am prompted to enter a key date or choose a variable for that. I then activate and fill that aggregate. Afterwards I deactivate it and remove the time-dependant attributes so there are no time-dependant attributes in the definition any longer. I then want to also remove the variable for the key date but I can't do so. This property is greyed out and there is no context menu for the entry "Variable for key date".
    The SAP Help says this should be possible by changing the key date variable through the context menu (see http://help.sap.com/saphelp_nw04/helpdata/en/7d/eb683cc5e8ca68e10000000a114084/frameset.htm).
    Has anyone faced this problem, too? I do not want to redefine my aggregate as this is not an elegant solution to the problem.
    Thanks to any answers in advance.
    Regards,
    Philipp

    Hey Karim,
    Because you have time dependent attributes in the aggregate you need to specify key date:
    check this
    http://help.sap.com/saphelp_nw70/helpdata/en/44/70f4bb1ffb591ae10000000a1553f7/frameset.htm

Maybe you are looking for

  • Issue on Deployment of AXIS framework in PI 7.0 Server.

    Hi Experts, We have a requirement of Using AXIS Framework in Receiver SOAP adapter in PI 7.0.Moreover we need USERNAME token with PasswordDigest.We have deployed aii_af_axisprovider.sda file in PI server with all relevant .jar files.However when we a

  • Interlace problem or compression artifact?

    Premiere 6.5 XP sp2 Quad-core 266 4 Gb RAM 7200 rpm SATA HDD for video projects I am working on a volunteer project for a local museum wherein some old VHS tapes need to be digitized.  The final video (probably MPEG-2) will be accessible from researc

  • Noobie school student needing some help with sqlplus on linux Oracle 10 XE

    I'm just learning so take it easy on me. I spent all night installing Oracle 10 XE on linux and trying to play catchup with my class. The problem I'm having is. When using sqlplus from the command prompt, I have setup a table called CUSTOMER. When I

  • Material specific pricing

    I've this scenario. I need to apply the following three pricing elements only for a specific set of materials, let's say "lubricants". 1.Lubricants need to have specific MRP of 20% (this is applied on  PR00). So this condition type in the pricing pro

  • RH 8 - How to retain File Update Settings

    Using RH8, integrated with FM9, when I open and close a project, the File Update Settings change for the linked FM chapters. Any ideas how I can prevent them from changing? Thanks, Stacy