Difference between calling static method and not static method?

Hi,
Suppose i want to write a util method, and many class might call this method. what is better? writing the method as static method or not static method. what is the difference. what is the advantace in what case?

writing the method as static method or not static
method. what is the difference.The difference is the one between static and non-static. Any tutorial or the JLs will clarify the difference, no need to repeat it here.
what is the advantace in what case?It's usually not like you have much of a choice. If you need access to an instance's attributes, you can't make it static. Otherwise, make it static.

Similar Messages

  • $.ajax(): what is the difference between calling a transaction and Xacute query?

    I can call either:
    $.ajax({
         type: "GET",
         url: "/XMII/Illuminator?QueryTemplate=somePathToXacute/someXacute&Content-Type=text/xml&Params...",
         dataType: "xml",
         success: function (result) {...}
    $.ajax({
         type: "GET",
         url: "/XMII/Runner?Transaction=somePathToTransaction/someTran&Content-Type=text/xml&Params...&OutputParameter=outXML",
         dataType: "xml",
         success: function (result) {...}
    When I call an Xacute query, the first execution works, but the second doesn't. I figured out that I have to add "cache:false" and then it is okay. If I use a transaction instead of Xacute query, it works with or without cache. Why is that? Transactions are not cached? Only Xacute queries?
    What is the cost difference in time if I call directly a transaction, instead of an Xacute query? What is the advantage to call an Xacute at all?
    Thx

    Hi Tibor,
    These points should clarify your doubts:
    1. Transactions are not cached but queries are.
    2. Advantage of using Xacute query is that the Illuminator service used to call Xacute query supports JSON from MII 14.0. Use content-type as text/json in the URL. But the restriction is that the transaction should return the XML in MII Rowsets-Rowset format.
    3. Though both the calls would take almost time(I think) but you should call transaction directly( no need to wrap it with Xacute query if not required).
    Regards,
    Rohit Negi.

  • Difference between a static class and singleton

    What is the difference between a static object and a singleton ?
    for example:
    1 )
    public class MyObject {
    static MyObject singleton ;
    public static MyObject getInstance() {
    if (singleton ==null) singleton = new MyObject ();
    return singleton;
    private MyObject () {
    supe();
    public void myMethod() {
    2 )
    public class MyObject {
    private MyObject () {
    supe();
    public static void myMethod() {
    If I need to call the myMethod() , witch of this solution is better ?
    // case 1
    MyObject.getInstance().myMethod()
    // case 2
    MyObject.myMethod()
    .....

    This has been discussed a lot here.
    Use the forum's search feature, or, since it's not necessarily reliable, use google.
    For many intents and purposes, they're equivalent.
    However, with a singleton you can implement an interface, and get polymorphic behavior. You can't do with with a class full of static methods (which, by the way, is NOT a static class).

  • Difference between invoking a method using reflect.proxy and reflect.Method

    Could any one tell me the difference between invoking a method using reflection java.lang.reflect.Method and java.lang.reflect.Proxy
    using both the class, we can invoke a method at runtime
    1)
    Method mthd=cl.getMethod("methodName",parameterName);
    Integer output=(Integer)mthd.invoke(new RunMthdRef(),input);
    2)
    Proxy.newProxyInstance(super.getClass().getClassLoader(), new Class[] { adapter }, new SomeClass(this));
    Does anybody have any idea?

    The two idioms are fundamentally different. Using java.lang.reflect.Method is how we call a method on a class, using Proxy is how we intercept that method call. An exercise for you, to illustrate that they do not do the same thing: write a simple class with one method, then use java.lang.reflect.Method to invoke that method, and then use a Proxy to invoke that method

  • Difference between calling a function module in background task and update

    Hi experts,
    Can someone explain me the basic difference between calling a FM in  background and update tasks?
    Also what is the advantage of using backgroud RFCs over the above 2.
    Thanks in advance,
    reddy

    This is essentially a difference of synchronization with the main program calling this FM.
    For Update task, we specify explicitely that we want to update some rows in a database table. But Update task is essentially for waiting that all tasks to do before are done and updating database at the end. The main point is that MF called in Update task wait for a COMMIT WORK to be executed.
    On the other hand FM in background task are executed immediatly and are not specific to updating database table : it can be a function that would return some values or something else like that.
    If you want to see more about difference between background jobs / update jobs, you can also have a look at transaction SM51. Here you will see all the servers composing your SAP instance and what kind of task they can execute :
    - background jobs corresponds to BATCH
    - update tasks corresponds to UPDATE
    Those 2 kinds of tasks stands not necessarily on the same server...
    Best regards,
    Samuel

  • Whts the difference between call transaction and session

    hi,
    can u plz tell me the differnces between call transaction method in BDC and session method.
    my doubt is even the call transaction method also can me scheduled using job scheduler then why do we need session method

    Hi
    BDC:
    Batch Data Communication (BDC) is the process of transferring data from one SAP System to another SAP system or from a non-SAP system to SAP System.
    Features :
    BDC is an automatic procedure.
    This method is used to transfer large amount of data that is available in electronic medium.
    BDC can be used primarily when installing the SAP system and when transferring data from a legacy system (external system).
    BDC uses normal transaction codes to transfer data.
    Types of BDC :
    CLASSICAL BATCH INPUT (Session Method)
    CALL TRANSACTION
    BATCH INPUT METHOD:
    This method is also called as ‘CLASSICAL METHOD’.
    Features:
    Asynchronous processing.
    Synchronous Processing in database update.
    Transfer data for more than one transaction.
    Batch input processing log will be generated.
    During processing, no transaction is started until the previous transaction has been written to the database.
    CALL TRANSACTION METHOD :
    This is another method to transfer data from the legacy system.
    Features:
    Synchronous processing. The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
    Updating the database can be either synchronous or asynchronous. The program specifies the update type.
    Transfer data for a single transaction.
    Transfers data for a sequence of dialog screens.
    No batch input processing log is generated.
    For BDC:
    http://myweb.dal.ca/hchinni/sap/bdc_home.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/bdc&
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.sapdevelopment.co.uk/bdc/bdchome.htm
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
    Check these link:
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
    http://www.sap-img.com/abap/question-about-bdc-program.htm
    http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
    http://www.planetsap.com/bdc_main_page.htm
    call Transaction or session method ?
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • What is the difference between organisation payment method and Assignment payment method?

    What is the difference between organisation payment method and Assignment payment method?
    As i am a new bie, i am curious to know this though it might sound a silly question.
    Thank you,
    Kuton

    You can create an Organization payment method of any Payment type(Cash, Check, BACS, NACHA etc) under the same country.
    All these will be valid payment methods on the payroll description form.
    And you can even attach these to a person.
    In which case you will have a Base currency (say USD) and payment currency (say GBP).
    These cases are not normal and only used by people who use a single BG for paying employees in 3-4 countries.
    So, unless you need to pay in different currencies, do not use it.
    Cheers,
    Vignesh

  • Difference between batch input method and batch input recording in LSMW?

    hi,
    plz tell me the difference between batch input method and batch input recording in LSMW?
    thanks & regards
    Ruban

    Hi Ruban,
               The main difference between the two is in lsmw we can view the code status at any time just by coming to prvious steps, but whereas in batch input method unless the recording is finished we cant view the code.
    second diff is tht we need to do lot of coding in batch inptu whereas here in lsmw we need not do much coding and mapping to data.
    third diff is that batch input is both inbound and outbound where as lsmw is only inbound.
    hope u got the differences.....
    Regards,
    sana M...

  • Difference between call screen and setscreen

    Difference between call screen and setscreen..
    can anyne

    Hi,
    The difference is as below:
    Call Screen:
    The system will go to process the called screen, leaving the processing of calling screen on hold. On using LEAVE SCREEN in the called screen, the system will come back and resume the processing of the calling screen.
    Set Screen:
    The processing of the calling screen is terminated and the system starts the processing of called screen. The execution will not come back to the calling screen again..
    Thanks and Best Regards,
    Vikas Bittera.

  • HT3696 How to know if your mac is using the latest Haswell architecture processor or not? and how to know the difference between the new imac and the 2012/13 imac?

    How to know if your mac is using the latest Haswell architecture processor or not? and how to know the difference between the new imac and the 2012/13 imac?

    Sorry to reopen an old post, but I've just purchased a 2nd hand late-2013 iMac (or so thats what the seller said).
    I'm always sceptical though, and just wanted to know if there is a way to check if my iMac is indeed the late-2013 model that included Haswell?
    I've attached screenshots of the About This Mac section hoping it may help shed some light.
    Thank you in advance for your help!
    PS - I can't compare to the iMac specs link you posted above because its now showing the late-2014 models.
    <Image Edited by Host to Remove Serial Number>

  • Difference between using history data and do not

    hi,
    I'm Tran, I come from VietNam.
    I've just learned LabView, I dont know the difference between using history data ( propety note of waveform chart ) and do not.
    please help me. And give me an example in labview or give me some document of this problem!!
    Tran
    thanks!!!

    aloalo wrote:
    I dont know the difference between using history data ( propety note of waveform chart ) and do not.
    Your question isn't clear, but I would like to say that, I've many times used this particular property node for clear the data (graph) from the chart.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    Example - Using HISTORY PN [LV 80].vi ‏16 KB

  • Difference between Ecc 5.0 and Ecc 6.0 SAP note number

    Hello Friends,
    Is any one knows difference between Ecc 5.0 and Ecc 6.0 version released SAP notes for FICO module.
    Thanks in advance for your help
    Thanks,
    Ratnam

    Hi,
    Check these
    Technical difference between 4.7 and ECC 5.0
    difference between sapr/3 4.7 and sapr/3 ecc 5.0
    Differences b/n 4.6c,4.7 and ECC 5.0
    Regards
    vijay

  • Difference between batch input method and direct input method in LSMW.

    Hi all,
    what is difference between batch input method and direct input method in LSMW. are they same?if differences are there tell me with details?

    Hi,
    Here are few differences bw Batch Input and Direct Inputs methods.
    Batch Input: Uses classical BDC approach, but doesn't required an ABAP program to be written to format the BDC DATA. The user has to format the data using predefined structures and store it in a flat file. Yet it is a slower updation method.
    Direct Input: Works similar to Batch Input programs. The difference is, instead of processing screens they validate fields and directly load the data into tables using standard function modules. Much faster and suits for large volume of data.
    Thanks.
    DhanaLakshmi M S

  • What is the difference between on new focus and do prepare out put methods

    Hi,
    what is the difference between on new focus and do prepare out put methods.

    Hi Divya,
    DO_PREPARE_OUTPUT method is triggered each time the view is prepared after each event. Normally we redefine this method in order default the initial values based upon the parameter iv_first_time = 'X'. There can be certain other scenarios like putting data validations where this method can be helpful.
    For details on ON_NEW_FOCUS, refer to this [thread|on_new_focus event;
    Thanks
    Vishal

  • Difference between a java program and a java class

    Hi there,
    What is the difference between a java program and a java class?

    HI,
    A java class is an object - described in a .class file - which has been given properties and behaviours and which can be instantiated in a program.
    A java program( application ) consists of at least one class (one of which must be declared public) and which executes its main() method ( of the public class ) when it is started.
    Every program is a class but not every class is a program.
    Examples:
    A java program
    // this simple program will print out the first command line argument you put
    // in after calling : java ScreenWriter "arguments"
    class ScreenWriter
    public static void main( String [] args )
    if( args.length > 0 )
    System.out.println( args[0] );
    A java class
    //the Math class is already defined in the java.lang package
    //and contains a constant for PI
    //So I can include the Math class with the PI constant in my simple program
    //and now I have a program that involves my ScreenWriter class and the Math class too.
    class ScreenWriter
    public static void main( String [] args )
    if( args.length > 0 )
    System.out.println( args[0] );
    System.out.println( "The value of Pi is: " + Math.PI );
    When you see package and import declarations at the start of a program they are there to ensure the compiler knows which classes are used in the program.
    Hope that helps,
    Terry

Maybe you are looking for

  • I need to create a banner in Fireworks but the canvas is only allowed to go up to 6000px at 300dpi, is there a way to make it larger?

    I need to create a banner in Fireworks but the canvas is only allowed to go up to 6000px at 300dpi, is there a way to make it larger?

  • Software and Firmware for an old AirPort unit

    Where may I find Airport Software and Firmware for an old AirPort unit. I have a 3.06 iMac Intel Core 2 Duo running OS 10.5.7 I am using an AirPort Extreme unit. I have the old AirPort that is dome shaped unit stored. iTunes does not show the Airport

  • JDBC  response  mapping

    Hello, I have  two sql statements (union ) selecting data from multiple tables and I have the sql XML as follows.   The response structure is also given bellow. Do I need a response  for STEMENT_TWO  also?  How do I map the result to single target ?

  • Repetetive Manufacu.

    Dear Experts, In My company Repetetive Manfuc. process is configured CO-PA is not configured we have two plants 1000  and 2000 Rem Profile is same for both plants but in my one plant 1000 every month i recieved an error message "Error determining the

  • 3GS switching itself off

    Hi everybody, I am having a problem with my 3GS where it keeps turning itself off. I have read a few other topics on this subject and know that a few other people have had the same problem and that it seems to be a hardware fault. My question is, I a