How could I know:WHO IS CALLING ME?

let's assume that, there are three classes: class A , class B and class C.in class C there is one method :println(String msg).And there is one method: method_A in class A,method_B in class B.
class A
&nbsp&nbsp...
&nbsp&nbsp public void method_A()
&nbsp&nbsp {
&nbsp&nbsp&nbsp&nbsp C.println("I am in method_A of classA");
&nbsp&nbsp&nbsp&nbsp ...
&nbsp&nbsp }
class B
&nbsp&nbsp...
&nbsp&nbsp public void method_B()
&nbsp&nbsp {
&nbsp&nbsp&nbsp&nbsp C.println("I am in method_B of classB");
&nbsp&nbsp&nbsp&nbsp ...
&nbsp&nbsp }
class C
&nbsp&nbsp...
&nbsp&nbsp public static void println(String msg)
&nbsp&nbsp {
&nbsp&nbsp&nbsp&nbsp if (DebuggingOn)
&nbsp&nbsp&nbsp&nbsp {
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp System.out.println("Called from Class:"+getCallerName() );
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp System.out.println(msg);
&nbsp&nbsp&nbsp&nbsp }
&nbsp&nbsp }
&nbsp&nbsp private String getCallerName()
&nbsp&nbsp {
&nbsp&nbsp //how to implement this?
&nbsp&nbsp }
in class C,when method println(String msg) being executed,how could I know who is calling me(println(String msg))?

I am not sure exactly what you want, is this supposed to be polly morphism so that both classes can be called by class C and they will tell what they are. fi so this code will work
class top {
   public void method();
class A extends top {
   public void method() {
      c.println("I am in method of class A", this);
   public String toString() {
      return " A";
class B extends top {
   public void method() {
      C.println("I am in method of class B", this);
   public String toString() {
      return " B";
class C {
   public static void println(String msg, top t)
     if (DebuggingOn)
       System.out.println("Called from Class:"+ t );
       System.out.println(msg);
}If called from class A will print out "Classed from Class: A" then the message and if called from Class B will print out "Classed from Class: B" then the message

Similar Messages

  • How could I Know who have delete a planning folder?

    Hi,
    I had a planning folder in Production, but today it have been deleted. I have in Integration, but I would like to know who deleted this folder. It is possible tu see a log o something like that??
    Is possible tha the user deleted the folder in upspm, because have the rol.
    Thanks

    Hi.
    I don't think it is possible to view who has deleted planning folder, but you can try SM21.
    Regards.

  • How do I determine who is calling me.  An unknown phone number is calling me late at night?  I want to find out who it is.

    How do I determine who is calling me.  An unknown phone number is calling me late at night?  I want to find out who it is.

    Yes, yes, yes. I am well aware about your line of Verizon is "THE Phone Company". Unfortunately, everyone was not subscribed  to "THE Phone Company" back before "THE Phone Company" was broken up. Some people have lines which were not in existence and have never been subscribers to "THE Phone Company". There are new area codes and numbers since "THE Phone Company" was broken up. I was unaware Straight Talk, T-Mobile, Sprint, Time Warner Cable, MagicJack, etc... automatically provide ALL of the private information of their subscribers to "THE Phone Company" simply so these other companies can exist. I was unaware "THE Phone Company" required each and every phone provider in the US to gather information for the USER of a phone when that USER was not the account owner. I don't remember giving my 15 year old daughter's information to "THE Phone Company" when I opened up her line 5 years ago. Obviously I did, since "THE Phone Company" has it as you would lead us to believe. I wasn't aware "THE Phone Company" required someone opening an account with 10 lines to provide the private user information for each and every one of those lines. When I opened up my 4 line account, I only remember giving out MY information. I don't remember validating everyone on the account was related to me. I don't remember giving out the names/DOB/SS #/etc... for everyone using the phones on my account. That information must have simply slipped my mind.
    For what it is worth, I never said they didn't have information on "every single number coming and going" thru their system. That is not the information being requested, though. The OP wants to know the name of the person making the call. If Verizon, aka "THE Phone Company" does not gather information on all users of a 10 line More Everything account from the account owner, where exactly are they getting this information. Furthermore, if they don't even gather this information of their own subscribers, why would you expect they have this information on the subscribers to other phone providers? It is not required to open a 10 line account. They do not run credit checks on all the users. They do not require SS#s on all of the users. They only require this information on the account owner. Are they staking out the account owner and following him/her to determine who is using the phones on his/her account? I guess I am simply too trusting.
    You speak of "back in the way old days". Well these are no longer the "way old days". Lines on an account can be scattered all over the US. The users of these phones aren't necessarily and more often every day not even related. "THE Phone Company" doesn't necessarily and is UNLIKELY to know the identity of the majority of people using phones on an account. The account owner, yes. Everyone else, NO. People making a call are just as likely using an area code/phone number of a location they don't even physically reside. "Back in the way old days" this was much less commonplace.
    Yes, they MAY be able to get the name of a caller, but it would take time and COULD take a considerable amount of time depending on the cooperation of the account owner.

  • How could I know the changes

    Respected,
           How could I know if some changes are made in configuration part  and by which user it has been done .Is their any path or transaction path to have a look at the changes   .
    THASNKS AND REGARDS
    AVANISH GULATEE

    Hi ,
    You need to aks the basis team to activate "change log" to view the changes done . Please note that activating the change log requires a lot of pressure on memomry usage and basis team have to take a final call on that. But once done , all the changes can be viewed using what Kahled had replied .
    Regards .

  • How can i know who get my photos and messages from my icloud???

    How can i know who get my photos and messages from my icloud???

    Nobody, except the persons who have your username and password or with whom you share photos streams would be able to see anything from you.

  • How can i know who get my photos and messages from my icloud???, How can i know who get my photos and messages from my icloud???

    How can i know who get my photos and messages from my icloud???

    The following website gives you an overview on how your iCloud data is encrypted: https://support.apple.com/kb/HT4865 So as long as you don not share your Apple ID with someone else, everything should be fine.

  • How to search ebooks in iTunes if I only know ISBN of one book? How could I know its iTunes book'ID from the isbn?

    Dear community members,
    I'm new here. I have a question about searching ebooks in itunes search API.
    If I know ISBN of one book, either 10-digit ISBN or 13-digit ISBN, how could I know its ebook ID in itunes store?
    In other words, is there any rule that I could convert regular ISBNs to ebook IDs? Or where I could find the reference?
    Thank you.

    Try searching Amazon or Barnes & Noble or your local library, if they have an online search, for the ISBN. That will give you the title of the book so you can then search the iBooks store. Or just buy the book from Amazon or B&N as a Kindle or Nook book; both have viewers for Windows and Mac as well as iOS devices.
    Regards.

  • When I put my phone into Do Not Disturb mode....how do I know who my favorites are who can override this feature

    When I put my phone iPhone 4s into Do Not Disturb mode, how do I know who my favorites are that can over ride this feature?

    The sort fields should generally be empty unless you've putting in custom values to sort solo artists by their surnames. You can apply common changes to thousands of tracks at once, just don't apply the wrong change because there is no undo.
    It is a good idea to backup before undertaking large scale changes. See this backup tip for a suggested approach.
    tt2
    Message was edited by: turingtest2

  • How do we know currently active call time in 6680?

    How do we know currently active call time? Whenever we receive or make a call, how can we know the call duration in Nokia 6680?

    Hello!
    Just take a look on page 27 of Manual.
    Recent calls: Connect -> Log -> Recent calls.
    Steps to activate call duration as follows: Connect -> Log -> Options -> Settings -> Show call duration. Select Yes.
    Andrey
    6150, 8310, 2100, 6310, 6310i, 6230, 6600, 6630, 6700, E60, N80, E61, N93
    N95, E61i, E71, E72,8600, 5800, N8

  • How could I know which table the synonym points to now?

    I have two tables with the same structure, TableA and TableB
    I create a synonym which points to TableA. In some senario, the synonym should be switched to point to the other table.
    How could I know which table the synonym points to right now? So that I can switch the synonym to the other table.
    Thanks a lot!!!!!!

    How could I know which table the synonym points to right nowSee all_synonyms view.
    So that I can switch the synonym to the other tableNot without drop synonym. You need to drop and recreate the synonym to point to the new table.
    Nicolas.

  • How could I know my kernel is 32 or 64 bit. I know there is a parameter

    Hello
    How could I know my kernel is 32 or 64 bit. I know there is a parameter. But which
    Thank you in advance

    Do you mean that you want to find out programmatically?  If not, it should be as easy as checking the properties under "My Computer".
    Regards,
    RIch Heilman

  • How could I see who imported a transport request

    How could I see who imported a transport request (not who is the owner)
    In import monitor I can see it but only for current day(or I can extend that period)

    goto SE01 ..
    enter the transport request ...display
    In
    Object List of Request
        Comment Entry: Released
            EC6XXXXXX 20080325 190541 USER <-- person responsible
    You'll have the person who released(USER)

  • The seriale number is not patent how could i know my phone is original?

    the seriale number is not patent how could i know my phone is original?

    Where did you buy the iPhone ,at the market ?

  • How could I know my PDK version

    hello,
    How could I know my PDK version installed?
    I can4t find it anywhere
    Thanks

    Hello,
    In this document there are a lot of references to different jpdk versions, but there is no point saying 'this version is...'
    The Revision History is at the bottom of the page, I suppose 'my' jdpk version is the newest one, JPDK 3.0.9.0.1 :::
    December 29, 2000
    January 25, 2001. Updated for JPDK v1.3
    February 2, 2001. Updated for JPDK v1.3
    March 15, 2001. Updated for JPDK v1.4
    April 14, 2001. Updated for JPDK v1.5
    April 27, 2001. Updated to rename JPDK 1.5 to JPDK 3.0.9.0.0
    June 14, 2001. Updated for JPDK 3.0.9.0.1 and corrected source code paths for samples
    Am I wrong?
    Thanks

  • How could i know my iphone 5c warranty provided by the carrier or the apple it self?

    How could i know my iphone 5c warranty provided by the carrier or the apple it self?

    Bcoz im having the problem regarding the network service. My phone shows No Service and keep on searching for network. Before, i use 'android' phone and theres no issue on coverage problem at the same place. Compare to the other iphone, theres no problem with the same network which shows 2 or 3 bars. Mine is totally 'No Service'.So, i changed my sim to a new sim, but still the problem happened. I started to restore my phone and nothing changed. Is that problem cause by the antenna of the phone? I bought my iphone at normal handphone shop. Since the problem occur, I sent my phone to the Apple Authorised Resselers for the warranty claim. But sadly they told me the warranty provided by the carrier although i didnt buy it through the carrier. So i sent it to the carrier to claim warranty and they adviced me that it will takes 14 working days. They told me that they will fix it by repair my iphone. Will i get 1 to 1 exchage for the warranty just because of that problem? Apple, please help me coz its the first time im using ios phone.

Maybe you are looking for

  • Safari cannot open PDFs in Preview

    When I view a PDF in Safari and I choose the "Open PDF in Preview" icon it opens instead in Adobe Reader, not Preview. Control clicking gives the only option as "Open with Adobe Reader xx.x.x". I don't have the AdobePDFViewer.plugin, either at the ro

  • Problems with JAVA in OSX Yosemite 10.10!!

    Even after installing JAVA 8 update 25 I keep getting a popup telling me I need to install JRE and when I search JAVA support I am referred to 'support.apple.com/kb/DL1572' but this does not open in apple. Any advice??

  • Folder disappeared after update!! How to recover it?

    Today i was prompted to update Mountain Lion to10.8.1 and after downloading it, my system was going to restart but Mail "crashed" and my Macbook Air didn't restarted (I waited for several minutes), I needed to go there and press restart. After that b

  • Syncing on 2 PCs

    Hi, as a surprise I bought a 6th gen nano for my girlfriend, filled it up with some songs from my iTunes library, put it back into the box and gave it to her. If she now links it to her USB-port, her iTunes on her PC does not recognize it. She has ve

  • Tell me if you think this looks like SIN CITY!

    I made this in After effects, but the colors didnt look good at all, so I brought it into motion to play around with, and with various blend modes, I made this look like the SIN CITY. I multiplied the clip, with the one on the bottom having a glow, b