Which method is going to be called

hi,
In case we have a subclass over riding a method. Once we instantiate the superclass and call the method which method is going to be called?
e.g
class C2
     private int i = 2;
     public void meth1(){
          System.out.println("super class static method");
class C22 extends C2{
     public void meth1(){
     super.meth1();
     System.out.println("sub class static method");
public class C3 extends C2
public static void main(String [] arg){     
     C2 c3 = new C2();     
     c3.meth1();
It appears that the C2's method is being called but once overridden shouldnt C22's method be called?

Yes, if you call the method on an object that is an instance of the C22 class, as in:
C2 c3 = new C22();
c3.meth1();Note the "new C22" instead of "new C2".

Similar Messages

  • Which method of JTextPane will be called when it is made visible

    HI,
    Can you please point to some method to override to perform an operation when a JTextPane in panel is shown when ever we swap between tabbed panes.so when i switch to some other tabbed pane and come back to this tabbed where my JTextPane exists so that i can apply some style attributes to data in the JTextPane.
    Regards,
    Sridhar.

    Any easier answer might be to listen for tab changes and use those to apply style attributes.
    DB

  • Determining which method to call from an array of Objects

    Hi All,
    Lets suppose I have an interface, a string method name, and an array of Objects indicating the parameters which should be passed to the method.
    What Im trying to work out is a way to quickly determine which method should be invoked.
    I can see that Class has getDeclaredMethod(String, Class[]), but that wont help me as I dont know the formal class types (the method may take X, but I might get passed Y which extends X in the array of objects).
    Does anyone know of a quick way I can determine this?
    All I can think of at the moment is going thru each method of the class one by one, and seeing if the arg is assignable, then, after getting all my matched methods, determining if there are any more 'specific' matches.
    Any ideas?
    Much appreciated,
    Dave

    you might want to take a look at the dynamic proxy apiCheers for the suggestion, but Im actually already using the dynamic proxy API.
    What I have is a MockObjectValidator which allows mock objects to be configuered with expected calls, exceptions to throw etc etc.
    I thought developers on my project would get tired using an interface like this:
    myValidator.setExpectedCall("someMethod", new Class[] { typeA, typeB }, new Object[] { valueA, valueB} );
    I.e, I wanted to cut out having to pass the class array, so they could just use:
    myValidator.setExpectedCall("someMethod", new Object[] { valueA, valueB} );
    The problem there is that I then need to pick the best Method from the class given the object arguments.
    When the mock object is in use, its no problem as the InvocationHandler interface provides the Method. The problem I have is selecting what method a user is talking about from an array of Objects.
    Ive written a simple one now, it just does primitive type class -> wrapper substitution, and then finds ** A ** match. If there is more than one match (ie, all params are assignable to a class' method params), I dont let that method be used.
    Shortly I'll update it to actually make the correct selection in those cases.
    cheers
    Dave

  • Display which method called the method (gives you a headache doesn't it)

    Hi,
    This question might sound a little weird, so maybe read it twice:
    I would like to see which method called the method.
    public void test1()
       test2();
    public void test2()
       System.out.println(....);
    The program output should be, test1 or classname.test1 or something like that. Is that possible?
    Thanx in advance, Yvo van Beek

    This should give you an idea:   public static void main (String args[]) {
          wereAreWe();
          caller2();
        public static void wereAreWe() {
          try {
            throw new RuntimeException("here we are");
          catch (Exception ex) {
            System.out.println("");       
            ex.printStackTrace(System.out);
        public static void caller1() {
          wereAreWe();
        public static void caller2() {
          caller1();
        }You can parse the result of printStackTrace() to get a more precise output.

  • Which method will be called, when invoking home.create() ?

    Hi,
    In a Stateless session Bean, I want initialize some variables, whenever a bean is created or retrieved from the pool. So I used the ejbCreate() method to initialize the variables, but it is called only first time when I call the home.create(). If I call the home.create() method next time it doesn't call the ejbCreate().
    Which method will be called, whenever I call home.create();.

    hi siva,
    first of all Ejbcontainers maintain a pool of stateless sessionbeans .when you call home.create() the ejbCreate () method is definitely called and you said you are initializing some variable and may be you are trying to retrive that value after home.create() method.. when you try to retrive the value thee value may be same as you have initialized or different depending upon the no of stateless session beans in the container. you have created a bean and there is no guarantee that the same bean will be called when you invoke retrieval method..
    i hope you understood.
    cheers

  • Which method should use? Call Transaction or Session Method?

    I need to upload 1,00,000 records then which method i need to use? Either session or call transaction?

    Hi.....
    A (asynchronous updating) The called transaction does not wait until the database has been
    updated, it simply forward the updates to the SAP update service. This usually speeds up the CT
    program. This processing mode is NOT recommended for large data sets as the called transaction
    does not receive a completion message from the update module.
    The calling CT program therefore cannot tell if the transaction has been successfully completed. You
    should use the updating administration function (transaction SM13) to determine whether updating
    was terminated early. The error analysis /correction functions for are less helpful than with
    synchronous updating.
    S (synchronous updating) With synchronous updating the called transaction waits until all the
    updates have been completed. So processing is slower than with synchronous updating. The called
    transaction can however report any updating errors to the program, which makes error
    analysis/correction easier.
    And
    Unlike the classical batch input processing with sessions CALL TRANSACTION does not offer any
    special processing procedures for transactions containing errors. There are no restart functions for
    transactions that contain errors or that cause updating terminations.
    Now you decide which one is best...
    For large amount of data Sessions method is the better.
    Thanks,
    Naveen.I

  • Which toString() method does System.out.println() call?

    Which toString() method does System.out.println() call? I know that if I did something like System.out.println( new myClass() ) that the toString being called would be that of the myClass class.
    My initial thought about this was that System.out.println() is the equivalent of System.out.println( new Object() ) but I remember trying that in a test program and it gave me a myClass@some_hash_code type of message when adding the new Object() part within the System.out.println().
    Could someone please tell me which toString the System.out.println() statement calls? Also, it would be great if an elaboration follows :).
    Any input woudl be greatly appreciated!
    Thanks in advance!

    s3a wrote:
    My initial thought about this was that System.out.println() is the equivalent of System.out.println( new Object() ) Huh?
    In one method call you pass no parameters in the other method call you pass one parameter. How could you possibly think that they would do the same thing?
    Could someone please tell me which toString the System.out.println() statement calls? Also, it would be great if an elaboration follows :).Yes. The toString of the class of the object which you pass to the method. If that class does not have a toString method it uses the toString method it inherits from the parent class. If the parent class does not have a toString method it uses the one inherited and so and so on all the way up to the Object class.

  • How come property attribute of jsp:getProperty  knows which method to call

    Hello friends,
    I could not understand How come property attribute of <jsp:getProperty knows which method to call
    <jsp:useBean id="test" class="BeanTest.testing" scope="page" />
    <jsp:getProperty name="test" property="name" />
    there is no method "name" in testing.class file
    if u see the existing examples "date" given in TOMCAT , it is using many <jsp:getProperty tag, but the property name is not equal to the method method name in the Bean file
    thanks,

    First do you know what a
    bean property sheet is?
    If not say so.
    Second, to your question
    The Java Runtime Environment (JRE) uses introspection to identify the appropriate get() or set() methods of that bean. What is introspection?
    Introspection is a process that allows the class to expose its accessable variables and methods and allows other classes to see what they can do with that class when requested. Eg:
    public class MyBean{
    private String someValue = null;
    public MyBean(){
    someValue = "Some String Value";
    //Introspection will reveal this method
    public String getSomeValue(){
    return someValue;
    } and
    <jsp:getProperty name="...." property="someValue" />
    will call the getSomeValue() method

  • Help Determining Which Methods/Classes Are Being Used

    Hello,
    I'm having issues with my company's Java application and because I've luckily narrowed the classes down to a meager 30+ I need some help pinpointing my problem.
    I realize there are a lot of Java monitoring applets/applications and some are deployment-specific but I need something very detailed-- I haven't found the features I need.
    Specs:
    Jrun4, Java 1.4, Windows Server 2003
    I would like to have a monitor that tells me exactly (real-time) what classes, methods, variables, etc. are being called in real-time. Looking at the JRun launcher console for one process gives me this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
    01/16 14:05:33 error Software caused connection abort: socket write error
    java.net.SocketException: Software caused connection abort: socket write error
            at java.net.SocketOutputStream.socketWrite0(Native Method)
            at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
            at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
            at jrun.servlet.io.MetricsOutputStream.write(MetricsOutputStream.java:75)
            at java.io.BufferedOutputStream.write(BufferedOutputStream.java:106)
            at jrun.servlet.http.WebOutputStream.write(WebOutputStream.java:64)
            at jrun.servlet.file.FileServlet.pipeData(FileServlet.java:419)
            at jrun.servlet.file.FileServlet.service(FileServlet.java:254)
            at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
            at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)This is cute, but not really helpful. I would like to determine what was passed to the process, from where and what went wrong.
    For example,
    Instead of this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
    01/16 14:05:33 error Software caused connection abort: socket write errorI would get something like this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
            Page variables: test.jsp ($var1= "I'm"; $var2= "Going"; $var3="To"; $var4="Break"; $var5 = null)
            Calling: test2.jsp
            With: jrun.bin.db.foo.Bar();
    01/16 14:05:33 error Software caused connection abort: socket write error
            Problem: $var5 = null;Sorry if I'm rambling, I just want to know what is where and who it's calling when it breaks. Then I could deduce which class, what variable, what page, etc. My application is very complicated and seemingly mundane changes can throw it all off.
    Any ideas?

    We'll look into usage tracking. We're on the standard edition, so I'm not sure if it's available. Also, some of these reports may be quarterly -- so there may be a long wait to see if the view is used and I need to know fairly soon. (If it's not used, it saves us some work in a project transition going on.)
    I certainly don't understand the underlying structure of the product, but it seems like there should be some way to determine if a view is used by a report. I apologize if I'm not using the correct terminology. Thanks for your help -- we'll keep looking into it.

  • BDC which Method to adopt ? Why ?

    Hi,
       1. Suppose i need to upload 5000 transaction records, of which 50 might turn error, Which method should i adopt ? Why ?
       2. In Call transaction method, if an error record comes in the middle of 5000 records, like 51st record is giving UPDATE error, Will it go to the next transaction OR will it stop there ?
       3. In session method, it is said that: only after database update of previos transaction it goes to the next one, ie syncronous database update. Does it mean that if an error record comes in session, it will not go to the next without update..?
       4. Suppose we got the result as 50 records -error. How will we upload these error records after correction ? Will we have to upload only this 50 records ?
    What will happen if we RUN the upload with all 5000 records again after the 50 records are corrected in the input file ?
       5. What is special about BDC, that no other upload method is having ?

    Hi Huzefa ,
    Following are some points of diffrence between session and call transaction method based on How databse is updated and how errors are handled
    1.How database is updated:-
    In Batch Input session , sap databse is updated during processing of the bach input session , while in Call transaction/Dialog method , the databse is updated as per execution of the of the batch input program.
    2. How errors are handled:- In session method arrors are handled automatically by the system during the processing odf the session.These erros are kept there and if u run this session again then only erros are processed.
    While in Call transcation method , erros are not handled by system , they must be handled manually.If u run proagram for this case, process starts from scratch.
    Refer to this Link :
    http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-
    in-bdc.htm
    Regards.
    Note: Reward if useful.

  • In BDC, I Have 10,000 Records Which Method do I Select? and Why?

    Hi all,
    In BDC , I Have 10,000 Records of Material Master Application. I have go through by Session Method or Call Transaction Method. Which Method do I Select? and Why?

    Hi..
    There you hav to go for sessions method....
    because...
    1. session methos has auto matic error handling option. so if there is any error in last but 100 th reocrd it will just threws that record and remaining part willl complete.
    2. And it was offline method.. means formatting of the data and assigning to Sap lay can be done in two steps... So you  10000 recors can update in expected time comaper with Calltransaction method...
    Get back to me if you are not satisfy with above reasons.
    Thanks,
    Naveen.I

  • Which Method Should be overriden to update a column in master?

    Hi,
    I have a Master/Detail relationship with the requirement to update master depending on some column in detail. This update of master can raise an exception and it should be done at post time. The way to update master changes depending on the DML action. If an exception is raised I want to rollback the changes made to master.
    I tried prepareForDML, postChanges methods. In both cases the exception is ignored and the transaction is not commited and does not display any message visible. But the exception can be catched and visible on console.
    I tried creating a validation method on detail entity. In the validation method I update master and call master.validate. This seems to work but the validation method can be called more than once and thus can update master more than once which is invalid.
    So which method should I use to post changes of the master?
    I present detail data as a ADF-Table. I want to display the exception as attached to a row in ADF-Table, just below the row in the table. Is it possible?
    Regards,
    Salim

    Jan,
    I have OrderItems and deliveryItems entities with 1..* relationship. I want to update OrderItems.deliveredQuantity and OrderItems.returnedQuantity fields based on delivery Type (i.e return, accept). OrderItems entity has an entity-level validation rule as quantity >= deliveredQuantity - returnedQuantity. So it might throw exceptions on Validate.
    I decided to implement this functionality in deliveryItemsImpl.postChanges, deliveryItemsImpl.prepareForDML and finally in an entity level validation rule (method) in deliveryItemsImpl. In postChanges and PrepareForDML it just ignores the exception, does not commit, does not give any error messages. In the last case it retries to validate the entity continously and cannot validate. To my opinion it should stop saying this entity is invalid. Isn't?
    Jdev 10.1.3.3
    ADF-Faces, ADFBC
    Regards,
    Salim

  • How can i know in which method i am?

    I would like to know ( for debugging reasons ) in which Method the execution code is!
    Like the printStackTrace() which indicates:
    - package
    - class
    - method
    - line
    at mypackage.myclass.mymethod4(MyClass.java:40)
    at mypackage.myclass.mymethod3(MyClass.java:30)
    at mypackage.myclass.mymethod2(MyClass.java:20)
    at mypackage.myclass.mymethod1(MyClass.java:10)
    at java.lang.Thread.run(Thread.java:484)
    Does anybody knows how to do this?
    Bye
    Emiliano

    This will return the calling class.method() of a class.
    public static String getCallingClassMethod() {
         try {
              Exception e = new Exception();
              // make a buffer to store the stack trace       
              java.io.ByteArrayOutputStream buffer = new java.io.ByteArrayOutputStream();
              java.io.PrintStream stackInfo = new java.io.PrintStream(buffer);
              e.printStackTrace(stackInfo);
              // create the tokenizer to get each line       
              java.util.StringTokenizer stackInfoParser =
                   new java.util.StringTokenizer(buffer.toString(), "\n");
              int n = 4;
              // *nix system only need 4 tokens windows has 2 extra
              if (System.getProperty("os.name").startsWith("Windows"))
                   n = 6;
              // loop through all the crap that comes before our calling method
              for (int i = 1; i < n ; i++){
                   stackInfoParser.nextToken();
              // get our calling class.method
              String returnString = stackInfoParser.nextToken().trim();
              // get rid of the garbage
              returnString = returnString.substring(returnString.indexOf(" ") + 1,
                   returnString.indexOf("("));
              return returnString;
         } catch (Exception e) {
         return "";
    }

  • HT4623 ios 6 and want to down grade to ios5 kindly confirm which methods i can do this

    ios 6 and want to down grade to ios5 kindly confirm which methods i can do this
    thank you in advance for your assistance,I look forward to your prompt response

    I am unable to to make or receive calls althought i reset the phone as well as the network setting.In addition to the above i contacted vodaphone  and they mentioned everything is fine with the sim card.Any other suggestions???

  • Error ocurring when Event Listener methode in "for statement" is called

    Hy guys,
    I would be gratefull if somebody could answer me how can I
    call a method from flex in "for statement", that is actually in my
    remote service implemented. I call the method loadAssetsResult()
    (event listener method in my action script) and get a collection of
    objects back. In the same method I want to iterate throught this
    collection and call another method from remote service, that is
    specified for this object. Problem is when I call this remote
    method inside of this loop statement. I get the error when I write
    my code like following one:
    public function loadAssetsResult(event:ResultEvent):void {
    for (i=0; i<event.result.length; i++) {
    a = new Asset();
    a.longName = event.result
    .longName;
    a.shortName = event.result.shortName;
    a.isin = event.result
    .isin;
    a.nsin = event.result.nsin;
    a.currentDayClose = event.result[0].currentQuote.dayClose;
    //Schluskurs
    assets.addItemAt(a, i);
    RO.getIndicatorCollection(i);
    DataBinding();
    When I comment the row: RO.getIndicatorCollection() it works,
    of course without these additional data that I get from that
    method. I need to call this method inside loop statement (for each
    object), but I don't know how, without getting this error?
    please somebody help me with some ideas
    br
    Sheila

    Kris,
    First of all you should increase the value of logging-config/character-limit element in tangosol-coherence.xml to see the message entirely. The default setting is 4096 which is not enough to see your exception text.
    When you do that I believe you will see that the actual exception is java.lang.ClassNotFoundException indicating that the node that has the listener installed doesn't know about the class that is being put into the cache and could be easily fixed as shown here: http://www.tangosol.com/faq-coherence.jsp#classnotfound
    Please let me know if that doesn't help.
    Gene

Maybe you are looking for

  • DMP does not show html link

    Hi, We are deploying a DMM system with DIgital Signs, version 5.3.0. We are using DMP 4310G with the beta version of firmware 5.4 as this is the only one with a browser. We need to show Cisco unified Intelligence Center ( CUIC ) reports of IPCCE. Whe

  • Help needed with Template Footer displacing with addition of a float..

    I have a template for a web page and I am a little stuck now with an issue related to floating an image (left) to get the text to wrap around. As I do so, the footer at the bottom displaces and I cannot work out why? Any help greatly appeciated. I ca

  • How to use OracleParameter whith the IN Operator of select statement

    Hi, I am having problems using the OracleParameter when used in a query with a IN operator. Following Example: oraCommand.Parameters.Add(":List", strMylist ); //or Array??? The SQL command: SELECT * FROM XXX WHERE XXX.YYY IN (:List); What datatype mu

  • Add helper class public parts as used DC in EJB DC

    Hi Experts, I have created a JAVA DC project containing the helper classes. For this helper classes i have created a Jar file. I have also created two public parts 1) with an option Can be packaged into other build results (e.g. SDAs) 2) with an opti

  • Flex DataGrid last empty column dynamic width

    Goal: have a blank right-most column in a DataGrid that takes up the slack in case the other columns do not total 100% of the overall grid width. This is what I have, which seems to work: <mx:DataGridColumn editable="false" sortable="false" minWidth=