Unable to access protected function from the child object

Hi all ,
I have an abstract class having one protected method
package foo;
public abstract class A {
  protected String getName(){
             return "ABC';
package xyz;
public class B extends A {
          public void print(){
                          *super.getName();//this will get called*
package abc;
public class Ex {
        public static void main(String [] args){
           B b = new B();
           *b.getName(); //Im not able to calll this function*
}{code}
My question is why I m not able to call the protected method from child instance but inside the class ???
I have checked this link , it also didn't say about the instance access or access within class .
[http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html]
Thanks and regards
Anshuman
Edited by: techie_india on Aug 31, 2009 11:25 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

jossyvjose wrote:
Hi Winston,
Did you mean like this? But still same behaviour.
package abc;
public class Ex extends A {
public static void main(String [] args){
B b = new B();
b.getName(); //still i am not able to calll this function
}No. Class 'Ex' would have to extend B in order to call b.GetName(). And I would definitely not make Ex part of your hierarchy (it's the sort of thing you see in SCJP questions, but definitely a bad idea).
What you can do though is to override the method; and Java allows you to change the visibility of overriden methods, provided they are more open. Thus, the following would be allowed:
package foo;
public abstract class A {
   protected String getName(){
      return "ABC';
package xyz;
public class B extends A {
   public void print(){
      System.out.println(super.getName()); // your previous code does nothing...
   public String getName() { // Note the "public" accessor
      return super.getName();
package abc;
public class Ex {
   public static void main(String [] args){
      B b = new B();
      b.getName(); // And NOW it'll work...
{code}Note that this is just example code. I wouldn't suggest it as general practise.
Also, when you write *public* methods, you should generally make them *final* as well (there are exceptions, but it's a good habit to get into; like making instance variables *private* - just do it).
HIH
Winston                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Unable to access gif files from the server

    hi all,
    i have successfully signed an applet and it is loading in the client system also. in that applet, i instantiated a jbutton as given below:
    JButton jb = new JButton(new ImageIcon("http://192.168.91.154:8080/success/set.gif"));
    but the icon din appear and a blank button appears, even when accessed from the server system.
    if i give the exact path like c:/blazix/webfiles/success/ set.gif, the icon is coming in the server system but not in other systems. i tried without port no also but in vain. pl solve my problem. what i need is how to
    specify the path of the file[any file] which is present in server.
    or if i put all the gif files in the jar file, can i access the gif files present in the jar file [set for archive] ? if i can, give me the soln for accessing the gif file present in the jar file, so that i need not access the server to get the gif files.(i.e) how to specify the path of the gif files present in the jar file?
    i ve one more doubt. the jni library file shld be in the server, and the client has to access the library in the server. i think the applet loaded in the client ll search for the library in the local m/c only . how to make the applet to search for library in the server??
    i feel only by using rmi we can solve this problem. am i correct? if so i feel that an appln or applet running in the server shld access the jni library, and the applet in the client side should communicate with this server appln using rmi to get the data.is it correct? is there
    anyother way?
    i appreciate your help in this regard. thanks in advance. bye, padmanbhan.

    Better information on what you are doing with JNI might help you get an answer.
    If you have some server process that needs to use JNI, then I would code a servlet to call, instead of using RMI to ge there.
    Depending on your environment, and the target audiences environment, RMI may just cause you a lot of grief. Firewalls etc, get in the way of RMI connections and force security holes to be opened in order to work.
    If you use a servlet, then traffic to your server process is done via standard http calls, which will already be enabled, because your app runs in a browser.
    If ther data requirements are heavy duty, your server could always send an XML stream to the client, which would allow you to describe complex data to the client.
    Running JNI stuff from the client directly means a lot of local infrastructure to run your app. The code you want to run, the JNI library ....
    If what you have is really an application, but want the convenience of starting it from a browser, look at Java WebStart. Then you can distribute an application via the browser, and WebStart will worry about the deployment issues for you.
    In Summary:
    Stay away from RMI from applets if you can help it.
    If you really have an App, then try WebStart to manage the distribution issues for you.

  • Access a main function from a child MXML

    Hi im just a beginner in flex.Someone please giude me.
    I have a main MXML which holds another MXML.Is there any
    possiblity to access the main MXML component from the child MXML.If
    there is no possiblity i just want to know how to access the main
    MXML function from the child MXML script.
    thanks in advance
    karan

    Thankyou man..its working...i might require ur help in the
    coming days...
    hei do u have any experience in drawing API

  • Calling a Function in the Parent Window from the Child Window

    QUESTION: How do I call a function resident in the parent
    window from a child window?
    BACKGROUND
    I have a JavaScript function resident in the parent window
    that reformats information obtained from the Date object and writes
    the result to the parent window using the document.write( ) method.
    I would like to call this function from the child window and have
    it write to the child window instead. Is this possible? If not,
    must I rewrite the entire function and nest it in the below code?
    If so, what is the proper form of nesting?
    CODE: The code that creates and fills the child window is
    provided below. The highlighted area indicates where I would like
    to enter the information from the function resident in the parent
    window. I have tried every imaginable permutation of code that I
    can imagine and nearly destroyed my parent document in the process.
    I am very happy that I had a back-up copy!
    function openCitationWindow() {
    ciDow = window.open("", "", "width=450, height=175, top=300,
    left=300");
    ciDow.document.write("A proper way to cite a passage of text
    on this page:<br /><br />Stegemann, R. A. 2000.
    <cite>Imagine: Bridging a Historical Gap</cite>. " +
    document.title + ". [<a href='" + location.href + "'
    target='_blank'>online book</a>] &lt;" + location.href
    + "&gt; (");
    MISSING CODE;
    ciDow.document.write(").<br /><br /><input
    type='button' value='Close Window' onclick='window.close()'>");
    ciDow.focus();

    Never mind - I was doing something very stupid and wasn't
    calling the function as a method of a movie clip. I was simply
    calling checkTarget(event) rather than
    event.currentTarget.checkTarget(event); which seems to work.

  • Cannot access conflicts unable to retrieve contact information from the sync server.

    ITunes error message Cannot access conflicts unable to retrieve contact information from the sync server.

    I got this advice from Gator5000e on Apple Supposrt Communities:
    I use Windows 7 so the path to find this file
    might be different under a different OS.
    Close iTunes. Search on the words "conflicts.synconflicts".
    I renamed it  to conflictsold.synconflicts the .synconflicts is the extension so you can't
    rename that.
    Then restarted Windows. As a test I made changes to a note in NOTES on each device. Then connected them one at a time to my computer which has iTunes 10 and Runs Windows 7, it worked !

  • Scanner(Warning) : 027: Unable to read the sequence number from the Workstation object.

    Hi
    We are having trouble storing inventory scans from some workstations.
    We have a windows ONLY environment, with middle tier servers. (ZEN65SP1,
    W2KSP4).
    Some workstations are storing fine. The Storer function is working and we
    can see the storer functions for the 'good' workstations in the Inventory
    service window.
    However some workstations can't store to the inventory db, but DO populate
    eDir ZENworks inventory 'minimal information' but show "Scanner(Warning) :
    027: Unable to read the sequence number from the Workstation object." in
    the Scan Status...
    The Inventory service window shows no attempt by these workstations - it's
    almost as though the scan file is not arriving (though eDir knows/displays
    the scan file name)
    How does the workstation access the scandir in Windows only/middle tier
    environment? Does the scan xml stream get sent to the MT via http and then
    on to the scandir via CIFS?
    Any suggestions/explanations welcome!!
    Many thanks
    David

    David,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
    - Check all of the other support tools and options available at
    http://support.novell.com.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://support.novell.com/forums)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://support.novell.com/forums/faq_general.html
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • New to FIOS TV Multi-room DVR - Should I be able to use DVR functions from the other HD STBs?

    We just converted from Directv (three DVRs) to FIOS TV and am hoping I didn't make a huge mistake: The sales agent I spoke to said that the Multi-room DVR (Motorola QIP-7216-1) and non-DVR STB would enable me to get the same features I had with my Directv setup so each user could Stop/Start/Record programming from their own remote. Unless I'm doing something wrong, I can only perform DVR control functions from the real DVR. I can view recorded programming on the non-DVR STBs but pressing record for a live broadcast or trying to select a show to record from the guide doesn't work.
    I have the ActiontecGen2 MOCA connected MI424WR router, three HD STBs (Motorola 7000), one standard definition STB and the DVR.

    Tomd514 wrote:
    We just converted from Directv (three DVRs) to FIOS TV and am hoping I didn't make a huge mistake: The sales agent I spoke to said that the Multi-room DVR (Motorola QIP-7216-1) and non-DVR STB would enable me to get the same features I had with my Directv setup so each user could Stop/Start/Record programming from their own remote. Unless I'm doing something wrong, I can only perform DVR control functions from the real DVR. I can view recorded programming on the non-DVR STBs but pressing record for a live broadcast or trying to select a show to record from the guide doesn't work.
    I have the ActiontecGen2 MOCA connected MI424WR router, three HD STBs (Motorola 7000), one standard definition STB and the DVR.
    As you've found, you can only create recordings from the DVR.  If you want each room to have the ability to schedule recordings, then you need a separate DVR in each room.
    The FiOS Motorola DVRs cannot access recordings stored on other DVRs.
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it.

  • Best way to access Time Capsule from the Internet?

    I wanted to see if anyone knew of a program or setting I can use in order to access Time Capsule from the internet? I know that probably I will not be able to at this point access it directly, even though it is connected to the internet through my modem, but I do have a Mac at home that is connected to Time Capsule. Isn't their a way that I could connect to the Mac, but not through Back to My Mac, that would show Time Capsule as connected to it, so that way I could access the files? Any ideas would be appreciated.

    It is possible to mount the TC as a network hard drive when outside your regular network.
    1) You will need to reconfigure your router to forward the ports used for AFP (by default 548) to the Time Capsule.
    2) Then when outside the network make sure Finder is active, press Apple+K to bring up the 'Connect To Server' dialog.
    3) Input the WAN IP address of the network to which the TC resides on.
    4) You will be asked for the password used to access TC.
    5) The TC should appear as a mounted drive.
    It is then possible to access files on the TC as well as do a TM backup. To make life easier you can drag the mounted TC into your dock for easier access in the future.
    However, it is obviously recommended to use a strong password to protect the TC (configurable using Airport Utility in the 'Disks/File Sharing' tab). You may also need to use a service like DynDNS if your network does not use a static IP address.
    But I am using my home networks' Time Capsule successfully from the office.

  • I am unable to transfer song bought from the itunes store to my ipod- can anyone please assist?

    I am unable to transfer song bought from the itunes store to my ipod- can anyone please assist?

    What happens when you try?
    If the song is an older purchase (from more than a few years ago), it may have DRM (copy protection).  You can check by selecting the song on a list in iTunes, and doing a Get Info (right click - Get Into).  On the Info window Summary tab, if Kind is Protected AAC audio file, it has DRM.  Also note what it says there for Apple ID.  You need to authorize the computer you use with the iPod to play content purchased with that Apple ID.
    From the iTunes menu bar, under Store, select Authorize This Computer.  Enter the Apple ID (and password) used to purchase the song.  One computer can be authorize for multiple Apple IDs.
    NOTE:  More recent iTunes Store song purchases do not use DRM, although other type of media (such as TV shows and movies) still do.
    If that's not the cause of your problem, please post back with more details...

  • Since installing the latest software update I have been unable to access my mail app.the screen appears blank?

    Since installing the latest software update I have been unable to access my mail app.the screen appears blank?

    Force close the mail app and reset your iPad. See if that fixes it.
    In order to close the mail app, you have to drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the mail app and then swipe "up" on the app preview thumbnail to close it.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • I have a merge publication , it says : The merge process was unable to access row metadata at the 'Subscriber'

    The merge process was unable to access row metadata at the 'Subscriber'. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to write to, or use SQL Profiler to determine the source of the failure. 
    (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147200996)
    Get help: http://help/MSSQL_REPL-2147200996
    Could not find stored procedure ''. (Source: MSSQLServer, Error number: 2812)
    Get help: http://help/2812
    Failed to get metadata for a batch of rows. (Source: MSSQLServer, Error number: 20680)
    Get help: http://help/20680
    The process was successfully stopped. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199481)
    what can I do ?

    Hi,
    Are you facing the same problem when starting with a new subscriber database?
    From the error message suggested that replication metadata may be corrupt. I suggest you drop and re-create the subscription.
    Then click on synchronization status and run the snapshot agent. It hard to tell the cause unless we check Merge Agent error log.
    Regarding the Unreadable Characters,
    change system locale to Chinese if current system locale is English and test the issue. A computer restart is required to make the change effective.
    Thanks.
    Tracy Cai
    TechNet Community Support

  • HT204406 I am having a very difficult time with accessing my music from the cloud.  I need to have itunes open on my laptop in order for it to work.  And as soon as I close out itunes on my laptop, it gives me a warning that all users will be logged out. 

    I am having a very difficult time with accessing my music from the cloud.  I need to have itunes open on my laptop in order for it to work.  And as soon as I close out itunes on my laptop, it gives me a warning that all users will be logged out.  Help!!!

    Where are iTunes files located?
    No, I do not mean just the music.  Copying just the media/music files or the media folder creates problems.

  • The circuit of my macbook is dead yet the hard drive is fine.  I need to access a file from the hard drive, how can i do this? is there a cable i can connect to another mac that will let me transfer the file?

    The circuit of my macbook is dead yet the hard drive is fine.  I need to access a file from the hard drive, how can i do this? The mac turns on the screen freezes as bright blue.  Is there a cable i can connect to another mac that will let me transfer the file?

    There is another option if the Macbook will start up in Target Disk Mode.
    Restart the computer while holding down the T key. If you see the firewire symbol moving around on the screen you can connect this one to another one in TDM. You will need a suitable cable to connect the two Macs.
    http://support.apple.com/kb/ht1661
    Firewire symbol:

  • XML Report completes with error due to REP-271504897:  Unable to retrieve a string from the Report Builder message file.

    We are in the middle of testing our R12 Upgrade.  I am getting this error from the invoice XML-based report that we are using in R12. (based on log).  Only for a specific invoice number that this error is appearing.  The trace is not showing me anything.  I don't know how to proceed on how to debug where the error is coming from and how to fix this.  I found a patch 8339196 that shows exactly the same error number but however, I have to reproduce the error in another test instance before we apply the patch.  I created exactly the same order and interface to AR and it doesnt generate an error.  I even copied the order and interface to AR and it doesn't complete with error.  It is only for this particular invoice that is having an issue and I need to get the root cause as to why.  Please help.  I appreciate what you all can contribute to identify and fix our issue.  We have not faced this issue in R11i that we are maintaining right now for the same program which has been running for sometime.  However, after the upgrade for this particular data that the user has created, it is throwing this error REP-271504897.
    MSG-00100: DEBUG:  Get_Country_Description Return value:
    MSG-00100: DEBUG:  Get_Country_Description Return value:
    REP-0002: Unable to retrieve a string from the Report Builder message file.
    REP-271504897:
    REP-0069: Internal error
    REP-57054: In-process job terminated:Terminated with error:
    REP-271504897: MSG-00100: DEBUG:  BeforeReport_Trigger +
    MSG-00100: DEBUG:  AfterParam_Procs.Populate_Printing_Option
    MSG-00100: DEBUG:  AfterParam_Procs.Populate_Tax_Printing_Option
    MSG-00100: DEBUG:  BeforeReport_Trigger.Get_Message_Details
    MSG-00100: DEBUG:  BeforeReport_Trigger.Get_Org_Profile.
    MSG-00100: DEBUG:  Organization Id:  117
    MSG-00100: DEBUG:  BeforeReport_Trigger.Build_Where_Clause
    MSG-00100: DEBUG:  P_Choi
    Report Builder: Release 10.1.2.3.0 - Production on Tue Jul 23 09:56:46 2013
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.

    Hi,
    Check on this note also : Purchasing Reports Fail When Changing Output To XML REP-0002 REP-271504897 REP-57054 (Doc ID 1452608.1)
    If you cant reproduce the issue on other instance, apply the patch on the test instance and verify all the funcionality related to the patch works OK. Then move the patch to production. Or you can clone the prod environment to test the patch.
    Regards,

  • REP-0002: Unable to retrieve a string from the Report Builder message file;

    Hi,
    I've a custom report in which i need to display a large string, of more than 4000 characters. To cater to this requirement i've written a formula column which displays string upto 4k characters and for a string of size beyond 4k i am calling a procedure which uses a temp table having a clob field.
    For a small string the report runs fine but whenever a large string requirement comes into the picture, said procedure gets triggered and i get REP-0002: Unable to retrieve a string from the Report Builder message file.
    OPP log for the same gives an output as under:
    Output type: PDF
    [9/21/10 2:17:12 PM] [UNEXPECTED] [388056:RT14415347] java.io.FileNotFoundException: /app/soft/test1udp/appsoft/inst/apps/e180r_erptest01/logs/appl/conc/out/o14415347.out (No such file or directory)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:241)
         at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:172)
    Report Builder 10g
    BI Publisher's version : 4.5.0
    RDBMS Version : 10.2.0.4.0
    Oracle Applications Version : 12.0.6
    Searched for the same on metalink and found Article ID 862644.1, other than applying patch and upgrading version of BI Publisher is there any other workaround to display a comma seperated string as long as 60k characters, If any please suggest.
    Thanks,
    Bhoomika

    Metalink <Note:1076529.6> extracts
    Problem Description
    When running a *.REP generated report file you get errors:
    REP-00002 Unable to retrieve string from message file
    REP-01439 Cannot compile program since this is a runtime report
    Running the same report using the *.RDF file is successful.
    You are running the report with a stored procedure,
    OR you are running against an Oracle instance other than the one developed on,
    Or, you recently upgraded your Oracle Server.
    Solution Description
    1) Check that the user running the report has execute permissions on any stored
    SQL procedures called. <Note:1049458.6>
    2) Run the report as an .RDF not an .REP , that is remove or rename the .REP
    version of the report. <Note:1012546.7>
    3) Compile the report against the same instance it is being run against.
    <Note:1071209.6> and <Note:1049620.6>

Maybe you are looking for

  • Down payment with reference to sales order only

    We are posting Customer Down payment w.r.t Sales order number with line item number. How come we enter sales order number only without line item number at the time of down payment. Q2- After the down payment posting F-29 , how its possible to change

  • TABLE FOR INVOICE CLEARING DOCUMENT

    Hi Guys, What table will I use to view clearing document in Vendor with all the invoices applied and amount cleared? Regards, BTer

  • Set deletion flag for service orders

    Hi How do I mass update service orders and notifications to set the deletion flag. I tried with IW72 but no luck Please help. Thanks Kumar

  • Music is just going through songs with out playing them.

    I have iTunes Match, up until recently this has worked on my iPad 2 and iPhone 5 up until yesterday. Now when I select any music that is not downloaded to the Device, it does not playing anything. Just skips through the songs. I've tried turning matc

  • Problem to logout from gnome [SOLVED]

    Hello everyone. I changed my initab file to automaticly login a user and in bash_profile of this user i startx. So gnome starts automaticly when pc boots, but i have a problem with logout. I can't logout to console because after that i am automaticly