Use of final keyword on methods arguements ?

Hi All,
Just say I have an input arguement for a method which is an int. If I wanted to access the value stored by the input arguement reference inside an anonymous class that is contained in the method one way would be to pass the input arguement reference to a instance variable of the class that contains the method and use that.
// Declared at start of  class
int arrayIndex = 0;
methodName(nt inputNumber)
    arrayIndex = inputNumber;
    ActionListener task = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            // Accessing here
            anArray[arrayIndex] = 100;
}Just wondering, I used the final keyword on the the input arguement instead and then used the input arguement directly instead. It seemed to work ok. Is this good programming practice or are there some pitfalls to using this that I'm not aware of?
(I don't need to change what the input arguement reference points to)
// Alternate
methodName(final int inputNumber)
    ActionListener task = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            // Accessing here
            anArray[inputNumber)] = 100;
}Regards.

declaring it final guarantees that you will not change the value.Of course it does. That's what it's for. That's what it means. But you're only guaranteeing that to yourself. It doesn't form part of the interface contract so it's no use to anybody else. Which is the bigger picture.
Whenever i use any anonymous classes i prefer to use the final variables as long as i dont need to change their values.No you don't 'prefer' it, you are forced to do that by the compiler.

Similar Messages

  • Help needed understanding final keyword and  use 3

    Hi Everyone,
    I have been studying a book on multi-threading and have inadvertently come accross some code that I don't really understand. I am wondering if anybody can explain to me the following:
    1). What effect does using the final keyword have when instantiating objects, and
    2). How is it possible to instantiate an object from an interface?
    public class BothInMethod extends Object
         private String objID;
         public BothInMethod(String objID)
              this.objID = objID;
         public void doStuff(int val)
              print("entering doStuff()");
              int num = val * 2 + objID.length();
              print("in doStuff() - local variable num=" + num);
              // slow things down to make observations
              try{
                   Thread.sleep(2000);
              }catch(InterruptedException x){}
              print("leaving doStuff()");
         public void print(String msg)
              String threadName = Thread.currentThread().getName();
              System.out.println(threadName + ": " + msg);
         public static void main(String[] args)
              final BothInMethod bim = new BothInMethod("obj1");  //Use of final on objects?
              Runnable runA = new Runnable()      //Creating objects from an interface?
                   public void run()
                        bim.doStuff(3);
              Thread threadA = new Thread(runA, "threadA");
              threadA.start();
              try{
                   Thread.sleep(200);
              }catch(InterruptedException x){}
              Runnable runB = new Runnable()
                   public void run()
                        bim.doStuff(7);
              Thread threadB = new Thread(runB, "threadB");
              threadB.start();
    }If you know of any good tutorials that explain this (preferably URL's) then please let me know. Thanks heaps for your help.
    Regards
    Davo

    final BothInMethod bim = new BothInMethod("obj1");  //Use of final on objects?
    Runnable runA = new Runnable()      //Creating objects from an interface?          
         public void run()               
                                    bim.doStuff(3);               
    };Here final is the characteristics of bim reference variable and it is not the characteristics of class BothInMethod
    This means u cannot use bim to point to some other object of the same class
    i.e, u cannot do this
                       final BothInMethod bim = new BothInMethod("obj1"); 
                       bim  =  new   BothInMethod("obj2");  This bim is a constant reference variable which will point only to the object which it is initialized to
    and not to any other object of the same class later on.
    How is it possible to instantiate an object from an interface?Regarding this yes we cannot create an object from an interface but
    but here it is not an interface u are providing the implementation of the interface Runnable
    as
    new Runnable()
    }This now no longer stays an interface but now it is an object that implements the interface Runnable

  • What is the use of OTYPE_REF in Add method

    what is the use of OTYPE_REF in Add method

    class A
    static public void m(){}
    class B extends A
    static public void m(){}
    }is this over riding? well static methods are bind at
    compile time then there shouldnt be any over riding
    in case of static methods but when we use final
    keyword in the method of class A it makes an error.
    when static methods are bind at compile time then
    what is the use of final keyword with static methods?there is none, since static methods cannot be overridden and final prevents them from being overridden

  • Use of const keyword in java ?

    Hi All,,
    I want to know the use of const keyword with proper example.
    Many many thx in advance
    Cheers
    Souvik

    I want to know the use of const keyword with proper example.
    There is no proper example, because const is not used in Java. If you want to create a constant, use the final keyword.

  • Use of 'static' keyword in synchronized methods. Does it ease concurrency?

    Friends,
    I have a query regarding the use of 'synchronized' keyword in a programme. This is mainly to check if there's any difference in the use of 'static' keyword for synchronized methods. By default we cannot call two synchronized methods from a programme at the same time. For example, in 'Program1', I am calling two methods, 'display()' and 'update()' both of them are synchronized and the flow is first, 'display()' is called and only when display method exits, it calls the 'update()' method.
    But, things seem different, when I added 'static' keyword for 'update()' method as can be seen from 'Program2'. Here, instead of waiting for 'display()' method to finish, 'update()' method is called during the execution of 'display()' method. You can check the output to see the difference.
    Does it mean, 'static' keyword has anything to do with synchronizaton?
    Appreciate your valuable comments.
    1. Program1
    public class SynchTest {
         public synchronized void display() {
              try {
                   System.out.println("start display:");
                   Thread.sleep(7000);
                   System.out.println("end display:");
              } catch (InterruptedException e) {
                   e.printStackTrace();
         public synchronized void update() {
              try {
                   System.out.println("start update:");
                   Thread.sleep(2000);
                   System.out.println("end update:");
              } catch (InterruptedException e) {
                   e.printStackTrace();
         public static void main(String[] args) {
              System.out.println("Synchronized methods test:");
              final SynchTest synchtest = new SynchTest();
              new Thread(new Runnable() {
                   public void run() {
                        synchtest.display();
              }).start();
              new Thread(new Runnable() {
                   public void run() {
                        synchtest.update();
              }).start();
    Output:
    Synchronized methods test:
    start display:
    end display:
    start update:
    end update:
    2. Program2
    package camel.java.thread;
    public class SynchTest {
         public synchronized void display() {
              try {
                   System.out.println("start display:");
                   Thread.sleep(7000);
                   System.out.println("end display:");
              } catch (InterruptedException e) {
                   e.printStackTrace();
         public static synchronized void update() {
              try {
                   System.out.println("start update:");
                   Thread.sleep(2000);
                   System.out.println("end update:");
              } catch (InterruptedException e) {
                   e.printStackTrace();
         public static void main(String[] args) {
              System.out.println("Synchronized methods test:");
              final SynchTest synchtest = new SynchTest();
              new Thread(new Runnable() {
                   public void run() {
                        synchtest.display();
              }).start();
              new Thread(new Runnable() {
                   public void run() {
                        synchtest.update();
              }).start();
    Output:
    Synchronized methods test:
    start display:
    start update:end update:
    end display:

    the synchronized method obtain the lock from the current instance while static synchronized method obtain the lock from the class
    Below is some code for u to have better understanding
    package facado.collab;
    public class TestSync {
         public synchronized void add() {
              System.out.println("TestSync.add()");
              try {
                   Thread.sleep(2000);
              } catch (InterruptedException e) {
                   e.printStackTrace();
              System.out.println("TestSync.add() - end");          
         public synchronized void update() {
              System.out.println("TestSync.update()");
              try {
                   Thread.sleep(2000);
              } catch (InterruptedException e) {
                   e.printStackTrace();
              System.out.println("TestSync.update() - end");          
         public static synchronized void staticAdd() {
              System.out.println("TestSync.staticAdd()");
              try {
                   Thread.sleep(2000);
              } catch (InterruptedException e) {
                   e.printStackTrace();
              System.out.println("TestSync.staticAdd() - end");
         public static synchronized void staticUpdate() {
              System.out.println("TestSync.staticUpdate()");
              try {
                   Thread.sleep(2000);
              } catch (InterruptedException e) {
                   e.printStackTrace();
              System.out.println("TestSync.staticUpdate() - end");
         public static void main(String[] args) {
              final TestSync sync1 = new TestSync();
              final TestSync sync2 = new TestSync();
              new Thread(new Runnable(){
                   public void run() {
                        sync1.add();
              }).start();
              new Thread(new Runnable(){
                   public void run() {
                        sync2.update();
              }).start();
              try {
                   Thread.sleep(3000);
              } catch (InterruptedException e) {
                   e.printStackTrace();
              new Thread(new Runnable(){
                   public void run() {
                        sync1.staticAdd();
              }).start();
              new Thread(new Runnable(){
                   public void run() {
                        sync2.staticUpdate();
              }).start();
    }

  • Shoukd the 'final' keyword should be used on all input parameters?

    In my very limited experience as a java programmer have never seen this done any where. Except in the java.lang.Math class which has a final variable, of type double, called PI. As pi is not a value that should change during the execution of a program, though this is not passed in as a parameter.
    However, on a new project, a co-worker is proposing the use of the 'final' keyword on all input parameters as a standard. He has about 5 years experience of maintaining java systems and is putting this suggestion forward as in the past people have overwritten values passed in as parameters causing confusion. Personally I don't see why this is such a major issue if one reads the code of the called programs.
    I would be grateful if anyone has seen this done before, or has any views on the advantages or disadvantages of this.
    Thanks in advance,
    LS

    Lord_Sidcup wrote:
    In my very limited experience as a java programmer have never seen this done any where. Except in the java.lang.Math class which has a final variable, of type double, called PI. As pi is not a value that should change during the execution of a program, though this is not passed in as a parameter.
    I'm sorry, but this point is irrelevant. There are lots of final fields (but not that many final parameters) in Java, BTW. Every field you declare in an interface is automatically final, for example.
    However, on a new project, a co-worker is proposing the use of the 'final' keyword on all input parameters as a standard. He has about 5 years experience of maintaining java systems and is putting this suggestion forward as in the past people have overwritten values passed in as parameters causing confusion. Personally I don't see why this is such a major issue if one reads the code of the called programs.
    IMHO, it's definately not a major issue. It is simply being restrictive, to be restrictive. The guy may have "five years experience", but he sounds lazy, to me. Besides, the first thing I would do in that case (if final were the default), would be something like this:
    public void myMethod (final String a, final int b) {
      String myA = a;
      String myB = b;
    }And now, what has he won by making it final? It simply added some up front work for some people, with no real added value. Also, if I had to retroactively change my code, I would change it as follows:
    //Original Code
    public void myMethod (String myA, int myB) {
      String myA = a;
      String myB = b;
    // New code
    public void myMethod (final String a, final int b) {
      String myA = a;
      String myB = b;
    }That way, you wouldn't even have to worry about changing anything else about your method, as the variables actually used in the rest of the body will remain the same.
    I would be grateful if anyone has seen this done before, or has any views on the advantages or disadvantages of this.The only thing declaring the parameter final does, is it prevents you from assigning a new value to the variable. The instance that parameter references (as long as it is not immutable to begin with) can still be manipulated. I.E. except in some very narrow, and specific, cases, no value added, simply a restriction that exists to be restrictive.
    >
    Thanks in advance,
    LSEdit: And man, am I slow and long-winded.

  • Use VB Set keyword with Clone method?

    I am using the TestStand API with Visual Basic 6.0 SP5. Is is necessary to use the Set keyword when calling the Clone method of a PropertyObject? i.e. which is correct:
    Set thePropObj = existingPropObj.Clone("", 0)
    or
    thePropObj = existingPropObj.Clone("", 0)
    Seems the Set keyword would be required, but I am
    running into funny problems with this. I have a step
    that I am trying to create a copy of. (The step contains a call to a LabVIEW VI.) If I omit the Set keyword, execution hangs at the call to Clone. If I include the Set keyword, all information present in the original PropertyObject doesn't seem to get copied to the new one. (Also, oddly enough, if I omit the set keyword, and the step calls a CVI function, everything seems to work
    fine!)
    Anyone have any advice?
    Thanks in advance
    D. LaFosse

    Hello LaFosse,
    You need to use the Set keyword before the clone method statement. However, I have a couple of comments about the code you sent.
    This is the code you sent:
    ' Start up the testStand engine
    Dim theTS As TS.Engine
    Set theTS = New TS.Engine
    ' OK, load in the sequence file I
    ' created. This sequence file
    ' contains nothing more than a call
    ' to a VI in the main stepgroup of
    ' the MainSequence.
    Dim seqFile As SequenceFile
    Set seqFile =
    theTS.GetSequenceFile()
    ' get a handle to the MainSequence
    Dim seq As Sequence
    Set seq = seqFile.GetSequenceByName
    ("MainSequence")
    ' Get a handle to the step that calls
    ' the VI, and a property object for
    ' the step
    Dim theStep As Step
    Set theStep =
    seq.GetStep(0, StepGroup_Main)
    Dim theStepProp As PropertyObject
    Set theStepProp =
    theStep.AsPropertyObject
    ' Create another step. We will attempt
    ' to use Clone to fill in the
    ' properties of this step.
    Dim theOtherStep As Step
    Dim theOtherStepProp As PropertyObject
    Set theOtherStep = theTS.NewStep("",
    TS.StepType_Action)
    Set theOtherStepProp =
    theOtherStep.AsPropertyObject
    ' Call clone...this step will hang.
    theOtherStepProp =
    theStepProp.Clone("", 0)
    Basically the problem is that you are not loading the TypePallete after creating the engine. You shoud include right after the Set theTS = New TS.Engine:
    theTS.LoadTypePaletteFiles
    This should avoid the crash.
    Some Additional comments:
    1. With VB you don't need to create property objects from other objects. All the classes, except the Engine Class, inherit from the Property Object Class. The following Code does the same thing, but without creating propertyobjects directly:
    Sub MySub()
    'Variable Declaration
    Dim theTS As TS.Engine
    Dim seqFile As SequenceFile
    Dim seq As Sequence
    Dim theStep As Step
    Dim theOtherStep As Step
    'Create the Engine
    Set theTS = New TS.Engine
    'Load the Types
    theTS.LoadTypePaletteFiles
    'Get Sequence File
    Set seqFile = theTS.GetSequenceFile()
    'Get Sequence
    Set seq = seqFile.GetSequenceByName("MainSequence")
    'Get Step
    Set theStep = seq.GetStep(0, StepGroup_Main)
    'Clone the Step
    Set theOtherStep = theStep.Clone("", 0)
    'Using the inheritance functionality
    'gets the Step Status
    'Notice that theOtherStep is not a PropertyObject
    'and you can use all the properties and methods that
    'applies to the PropertyObject Class to a Step class
    'in this example
    'Also, in VB when you are typing the statement, you
    'will not see the PropertyObject Class properties and
    'and Methods automatically if the variable is not a
    'PropertyObject type. However, you can still use them
    'as mentioned before
    MsgBox (theOtherStep.GetValString("Result.Status", 0))
    End Sub
    2. When you create or modify sequence files programatically be carefull not to break the license Agreement. You need the development lisence when modifying sequences.
    3. This piece of code is not completed, and you will need to shutdown the engine by the end.
    4. Since you are not handling UI Messages, you will need to be carefull when loading sequences that have the SequenceFileLoad Callback. The engine posts UI Messages when executing this callback. Also when you shutdown the engine, UI Messages are posted. For both operations (Load Sequence and Shuutdown) you may prevent the engine from posting the message (You may check the options parameter for this two methods in TS Programmer Help.)
    5. If you want to run a sequence, again you will need to incorporate in your code the UIMessage Handler part. (You may check the TS Programmer Help->Writing an Application Using the API->UI Messages). Otherwise it may hang since the engine posts UI Messages eventually.
    Regards,
    Roberto Piacentini
    National Instruments
    Applications Engineer
    www.ni.com/support

  • Static and final keyword questions

    Brief summary: I want to make the JButtons, JLabels, and JPanels public static final. Is that bad, and why? And what the heck is the Java system doing when it compiles and runs a program that does this? Is the code more efficient?
    More questions below.....
    I'm new to making GUI designs with Java. I am going to school and my teacher is making us do GUI interfaces in JAVA.
    Early on, I learned that constants are identifiers similar to variables except that they holda particular value for the duration of their existence. QUESTION ONE: what happens during run-time, how does JAVA handle this constant?
    I also learned that some methods may be invariant, as with a simple extension. These methods should be marked final. The subclass inherits both a madatory interface and a mandatory implementation. So I guess you use a final method when you want to model to a stric subtype relatinoship between two classes. All methods not marked final are fair game for re-implementation.
    Well, that's good and well. So then I started thinking about static. That's a keyword in Java and when used with a variable, it's shared among all instances of a class. There is only one copy of a static variable for all objects of a class. So then again, I noticed that the programs in my book that used final usually threw in the word static before it. Memory space for a static variable is established when the class that contains it is referenced for the first time in a program.
    Well, that too is great? Question 2: In my GUI programs, can I declare all the buttons (JButtons), labels (JLabels), panels (JPanels) as being final constant static?
    In the program I don't intend to change the type of button, or JPanel so why not make it a constant? As long as I'm doing it, why not make it static? WHAT IS ACTUALLY GOING ON THEN IN MY PROGRAM WHEN I DO THIS?
    Question 3: What goes on in JAVA when I make a method or function public static final. Is that what the Math class does? How is that handled during run-time? Is the code faster? Is it more efficient?
    Question 4: If I make a class final, that means a subclass cannot extend it? Or does it mean that a subclasss cannot change it? I know that if the function or method in the parent class was final, then the subclass inherits both a madatory interface and a mandatory implementation....So if the class is final, then what?

    You have a lot of questions..
    You make a method final if it should not be allowed for subclasses to override it.
    If you make a class final, you will not be able to subclass that class.
    A static method is a class method, i.e. you don't need to create an instance of the class to call the method.
    You can make any object and primitive final, but for objects, you are still able to modify what is inside the object (if there is anything you can and are allowed to modify), you just can't change the final reference to point to another object.
    When you make a variable final, you sometimes make them static as well if they should work like constants. Because there is no reason that every instance of the class has their own copy of constants.
    If you make everything static, why even bother to work with object-oriented programming. It gives you no reason to make instances of your classes. You should try not to make static variables and methods when there is no need for it. Just because you start from a static main method, it doesn't mean it is necessary to make all variables and methods static.
    Don't think so much about performance issues as long as you are still learning java. When you make a method final, it is possible for a compiler to inline that method from where you call the method, but you will hardly gain much in performance with that. In most cases it's better to optimize the code you have created yourself, e.g. look at the code you run inside loops and see if you can optimize that.

  • How to reference a class without using the new keyword

    I need to access some information from a class using the getter, but I don't want to use the new keyword because it will erase the information in the class. How can I reference the class without using the new keyword.
    ContactInfo c = new ContactInfo(); // problem is here because it erases the info in the class
    c.getFirstName();

    quedogf94 wrote:
    I need to access some information from a class using the getter, but I don't want to use the new keyword because it will erase the information in the class. How can I reference the class without using the new keyword.
    ContactInfo c = new ContactInfo(); // problem is here because it erases the info in the class
    c.getFirstName();No.
    Using new does not erase anything. There's nothing to erase. It's brand new. It creates a new instance, and whatever that constructor puts in there, is there. If you then change the contents of that instance, and you want to see them, you have to have maintained a reference to it somewhere, and access that instance's state through that reference.
    As already stated, you seem to be confused between class and instance, at the very least.
    Run this. Study the output carefully. Make sure you understand why you see what you do. Then, if you're still confused, try to rephrase your question in a way that makes some sense based on what you've observed.
    (And not that accessing a class (static) member through a reference, like foo1.getNumFoos() is syntactically legal, but is bad form, since it looks like you're accessing an instance (non-static) member. I do it here just for demonstration purposes.)
    public class Foo {
      private static int numFoos; // class variable
      private int x; // instance varaible
      public Foo(int x) {
        this.x = x;
        numFoos++;
      // class method
      public static int getNumFoos() {
        return numFoos;
      // instance method 
      public int getX() {
        return x;
      public static void main (String[] args) {
        System.out.println ("Foo.numFoos is " + Foo.getNumFoos ());
        System.out.println ();
        Foo foo1 = new Foo(42);
        System.out.println ("Foo.numFoos is " + Foo.getNumFoos ());
        System.out.println ("foo1.numFoos is " + foo1.getNumFoos ());
        System.out.println ("foo1.x is " + foo1.getX ());
        System.out.println ();
        Foo foo2 = new Foo(666);
        System.out.println ("Foo.numFoos is " + Foo.getNumFoos ());
        System.out.println ("foo1.numFoos is " + foo1.getNumFoos ());
        System.out.println ("foo1.x is " + foo1.getX ());
        System.out.println ("foo2.numFoos is " + foo2.getNumFoos ());
        System.out.println ("foo2.x is " + foo2.getX ());
        System.out.println ();
    }

  • Use of 'ME' keyword in ABAP Objects?

    Hi all,
       Can any one please  use of 'ME' keyword in ABAP Objects?
    Thanks,
    Vijay.
    Moderator message: next time, please search for available information before asking.
    Edited by: Thomas Zloch on Sep 16, 2010 5:33 PM

    Hi,
    Please find the description about the ME keyword as per the SAP documentation and help.sap.com.
    Within the implementation of every instance method, an implicitly created local reference variable called me is available, which points to the instance in which the method is currently being executed. The static type of me is the class in which the instance method is implemented.
    Each class implicitly contains the reference variable me. In objects, the reference variable mealways contains a reference to the respective object itself and is therefore also referred to as the self-reference. Within a class, you can use the self-reference me to access the individual class components:
    -To access an attribute attr of your class: me->attr
    -To call a method meth of your class: CALL METHOD me->meth
    When you work with attributes of your own class in methods, you do not need to specify a reference variable. The self-reference me is implicitly set by the system. Self-references allow an object to give other objects a reference to it. You can also access attributes in methods from within an object even if they are obscured by local attributes of the method.
    Regards,
    Sagar

  • Purpose of Finally keyword?

    hi i just read this http://www.roseindia.net/help/java/e/finally-keyword.shtml but i still don't quite get the purpose or use
    of the finally keyword if it's executed no matter if the exception is thrown or not? like wat's the difference between just having a catch statement and code afterwards, and having using finally with the same code?
    thanks,
    newbie

    saru88 wrote:
    hi i just read this http://www.roseindia.net/help/java/e/finally-keyword.shtml but i still don't quite get the purpose or use
    That's probably because roseindia is a pretty bad site filled with half-truths, misinformed advice and straight out errors.
    Read [the official tutorial|http://java.sun.com/docs/books/tutorial/essential/exceptions/finally.html] instead.
    of the finally keyword if it's executed no matter if the exception is thrown or not?Yes.
    like wat's the difference between just having a catch statement and code afterwards, and having using finally with the same code?You can get almost the same effect as the finally block using this technique (almost, because you can't execute code after a "return;" this way, for example).
    It is harder however.
    Another important advantage of finally is that it is also executed when you don't catch the exception yourself (for example because you want it thrown further or you didn't expect that exception to happen).
    Finally is used for cleanup that needs to run, no matter if your try-block successfully completes or not.

  • HT204382 how to convert movies from flip for use in final cut pro

    How do you convert movies from a Flip video camera for use in final cut pro?

    DVDs are in a socalled delivery format (mpeg2), which isn't meant and made for any processing as editing...
    in recommended order, choose one of the following tools/workarounds:
    DVDxDV (free trial, 25$, Pro: 90$)
    Apple mpeg2 plugin (19$) + Streamclip (free)
    VisualHub (23.32$)
    Drop2DV (free)
    Cinematize >60$
    Mpeg2Works >25$ + Apple plug-in
    Toast 6/7/8 allows converting to dv/insert dvd, hit apple-k
    connect a miniDV Camcorder with analogue input to a DVD-player and transfer disk to tape/use as converter
    http://danslagle.com/mac/iMovie/tips_tricks/6010.shtml
    http://danslagle.com/mac/iMovie/tips_tricks/6018.shtml
    http://karsten.schluter.googlepages.com/convertdvdstodvs
    (advice is for imports to iM... )
    none of these methods or tools override copy protection/DRM mechanisms.. advice on 'ripping' is a violation of the ToU of this board ..
    +be nice to copy rights ...+

  • While uploading data into the r/3 using call transaction or session method

    hi experts
    while uploading data into the r/3 using call transaction or session method error occured in the middle of the processing then how these methods behaves it transfers next records or not?

    hai
    Session method: The records are not added to the database until the session is processed. sy-subrc is not returned. Error logs are created for error records. Updation in database table is always Synchronous.
    Call Transaction method: The records are immediately added to the database table. sy-subrc is returned to 0 if successful. Error logs are not created and hence the errors need to be handled explicitly. Updation in database table is either Synchronous or Asynchronous.
    While to transfer the data from the through if any errors occurs until the errors are the complete the data is not transfer to the SAP system.
    the system compulsory shows the errors. that errors are stored into the error logs (Transaction is SM35).
    so the session method should not return any value.
    In call transaction method data is directly pass to the SAP system.
    So its compulsory return the value.
    Because of the call transaction is the function.
    A function should return the value mandatory
    In session method errors stroed in SYSTEM GENRATED ERROR LOG.
    IN CALL TRANSACTION TO CAPTURE THE ERRORS WE SHOULD PERFORM THE FOLLOWING.
    FIRST ME MUST DECLARE AN INTERNAL TABLE WITH THE STRUCTURE OF BDCMSGCOLL TABLE.
    THEN WHILE WRITING THE CALL TRANSACTION STATEMENT WE SHOULD PUT THE 'E' MODE FOR CAPTURING ALL THE ERRORS.
    THEN FINALLY THE CAPTURED ERRORS MUST TO SENT TO THE INTERNAL TABLE WHICH WE DECLARED IN THE BEGINNING WITH BDCMSGCOLL BY USING THE FUNCTION MODULE "FORMAT_MESSAGE"
    AND THUS THE ERROR MESSAGES WILL BE SENT TO THE INTERNAL TABLE WHICH WE DECLARED AT THE BEGINNING.

  • Related with Final Keyword...

    Hi,
    I written the following code to iterate over an array :
    for(final int i:arr)
    System.out.println(i);
    }

    jschell wrote:
    I really doubt that the compiler doesn't erase the final part.
    It is a compile time rather than run time check.Runtime as well, it seems.
    public class Final {
      public static final int i = 999;
    public class FinalChanger {
      public static void main(String[] args) {
        Final.i = 123;
        System.out.println(Final.i);
    }1) Compile both without the final keyword in Final.java
    2) Put final into Final.java, and recompile.
    3) Run javac -cp . FinalChanger
    Exception in thread "main" java.lang.IllegalAccessError
            at FinalChanger.main(FinalChanger.java:3)
    :; javap -s -c -verbose -classpath . Final
    Compiled from "Final.java"
    public class Final extends java.lang.Object
      SourceFile: "Final.java"
      minor version: 0
      major version: 50
      Constant pool:
    const #1 = Method       #3.#14; //  java/lang/Object."<init>":()V
    const #2 = class        #15;    //  Final
    const #3 = class        #16;    //  java/lang/Object
    const #4 = Asciz        i;
    const #5 = Asciz        I;
    const #6 = Asciz        ConstantValue;
    const #7 = int  999;
    const #8 = Asciz        <init>;
    const #9 = Asciz        ()V;
    const #10 = Asciz       Code;
    const #11 = Asciz       LineNumberTable;
    const #12 = Asciz       SourceFile;
    const #13 = Asciz       Final.java;
    const #14 = NameAndType #8:#9;//  "<init>":()V
    const #15 = Asciz       Final;
    const #16 = Asciz       java/lang/Object;
    public static final int i;
      Signature: I
      Constant value: int 999
    public Final();
      Signature: ()V
      Code:
       Stack=1, Locals=1, Args_size=1
       0:   aload_0
       1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
       4:   return
      LineNumberTable:
       line 1: 0
    :; javac -version
    javac 1.6.0_06
    :; java -version
    java version "1.6.0_06"
    Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
    Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode)

  • How do I sync my iPod to iTunes? I've used the final steps from Article HT1329, but when I open my iPod there is no "iTunes" folder.&#160; Please help!

    How do I sync my iPod to iTunes?  I've used the final steps from Article HT1329, but when I open my iPod there is no "iTunes" folder.  Please help!

    Ah I see. That folder would only be there if you had perfomed the earlier steps in that section.
    Recover media from iPod
    See this post from forum regular Zevoneer for options on moving your iPod data back to your computer.
    tt2

Maybe you are looking for