Pls suggest a reason for a compile time error

the following program gives a compile time error bcoz of the statement
((State)this).val=this.val. if u could suggest why?
public class Mainc
public static void main(String args[])
State st=new State();
System.out.println(st.getvalue());
State.Memento mem= st.memfunc();
st.altervalue();
System.out.println(st.getvalue());
mem.restore();
System.out.println(st.getvalue());
public static class State
protected int val=11;
int getvalue()
     return val;
void altervalue()
     val=(val+7)%31;
Memento memfunc()
     return new Memento();
class Memento
     int val;
Memento()
     this.val=state.this.val;
     void restore()
          ((State)this).val=this.val;
}

The statement :
((State)this).val
tries to cast Memento into its super class State which is inorrect [former is not latter's subclass]
restore method should be as follows:
void restore()
State.this.val=this.val;
}

Similar Messages

  • Compile time errors for large code in try-catch blocks

    Hi, Has anyone ever faced this problem of a compile time error, where the Java compiler returns with the following error that Code is too large for try block.
    I have about 5000 thousand lines in my try-catch block and am facing this problem. Please suggest possible solutions

    1) Are you sure that your try/catch blocks contain 5 million lines?! I seriously don't believe this.Sounds like generated code. The generator needs to be a bit cleverer. In particular, it seems to be generating repeated blocks of code that ought to be stuffed into methods somewhere.

  • Pls Suggest server names for Reporting Server and Shared Services

    Hi,
    Can any one Pls Suggest server names for Reporting Server and Shared Services
    Thanks in advance.

    Report server name: OrclRpt
    Shared Services: OrclSS

  • Getting compile time errors during gwt application compilation

    Hi,
    I am getting below compile errors while running ant script for my GWT application.
    javac:
    [javac] Compiling 32 source files to D:\Projects\workspace\MckSurvey\war\WEB-INF\classes
    [javac] D:\Projects\workspace\MckSurvey\src\com\spinsci\survey\client\model\QuestionBean.java:38: type parameters of <X>X cannot be determined; no unique maximal instance exists for type variable X with upper bounds int,java.lang.Object
    [javac]           return get("questionId");
    [javac] ^
    I am using JDK 1.6 and ANT 1.7 s/w.
    below is the target which is used in the build file:
    <javac srcdir="src" includes="**" encoding="utf-8"
    destdir="war/WEB-INF/classes"
    nowarn="true"
    debug="true" debuglevel="lines,vars,source"
         includeDestClasses="false"
         source="1.5" target="1.5"      
              >
    <classpath refid="project.class.path"/>
    <compilerarg value="-Xlint:-unchecked"/>
    </javac>
    Please suggest me accordingly to overcome this generics compile time errors.
    Regards,
    Sunder.

    dannyyates wrote:
    There are/have been numerous examples of differences in spec interpretation between Eclipse (ecj) and the Sun compiler. I generally find that Eclipse is more accurate in it's interpretation than Sun! :-)
    I would suggest raising this on an appropriate Eclipse forum. The guys there are normally very good at digging into the issue and explaining why they think they are right or else admitting that they've got it wrong.I totally agree on both accounts. I myself have seen at least two compiler bugs and asked both the Sun guys and the Eclipse guys (through their respective bug tracking systems) and both have been resolved (in both cases ecj was actually right, but I wouldn't dare drawing any conclusions from that ;-)).

  • Compile time error

    I am a newbie in XML. I am trying to compile the following code. I am getting compile time errors. I have following environment varaibles set. Any help will be really appreciated.
    TIA.
    set JAVA_HOME=C:\Program Files\jdk1.3.1_03
    set JWSDP_HOME=C:\Program Files\jwsdp-1.1
    set JAXB_HOME=%JWSDP_HOME%\jaxb-1.0
    set JAXB_LIBS=%JAXB_HOME%\lib
    set JAXP_LIBS=%JWSDP_HOME%\jaxp-1.2.2\lib
    set JWSDP_LIBS=%JWSDP_HOME%\jwsdp-shared\lib
    set PATH=%JAVA_HOME%\bin;%JAXB_HOME%\bin;%JWSDP_HOME%\jwsdp-shared\bin;%PATH%
    set CLASSPATH=%JAXB_LIBS%\jaxb-api.jar;%JAXB_LIBS%\jaxb-ri.jar;%JAXB_LIBS%\jaxb-xjc.jar;%JAXB_LIBS%\jaxb-libs.jar;%JAXP_LIBS%\jaxb-api.jar;%JAXP_LIBS%\endorsed\xercesImpl.jar;%JAXP_LIBS%\endorsed\xalan.jar;%JAXP_LIBS%\endorsed\sax.jar;%JAXP_LIBS%\endorsed\dom.jar;%JWSDP_LIBS%\jax-qname.jar;%JWSDP_LIBS%namespace.jar;.
    C:\Learn XML>javac -verbose CountSax.java
    [parsing started CountSax.java]
    [parsing completed 63ms]
    CountSax.java:3: package org.xml.sax does not exist
    import org.xml.sax.* ;
    ^
    CountSax.java:4: package org.xml.sax.helpers does not exist
    import org.xml.sax.helpers.* ;
    ^
    CountSax.java:5: package javax.xml.parsers does not exist
    import javax.xml.parsers.*;
    ^
    CountSax.java:7: cannot resolve symbol
    symbol : class DefaultHandler
    location: class CountSax
    public class CountSax extends DefaultHandler {
    ^
    [loading C:\jdk1.3.1_02\jre\lib\rt.jar(java/lang/String.class)]
    CountSax.java:22: cannot resolve symbol
    symbol : class Attributes
    location: class CountSax
    public void startElement(String name,Attributes atts) {
    import java.io.* ;
    import org.xml.sax.* ;
    import org.xml.sax.helpers.* ;
    import javax.xml.parsers.*;
    public class CountSax extends DefaultHandler {
    public static void main(String args[]) {
    SAXParserFactory factory = SAXParserFactory.newInstance() ;
    SAXParser saxParser = factory.newSAXParser() ;
    saxParser.parse(new File(args[0]),new CountSax()) ;
    static private int eltCount = 0 ;
    public void startDocument() {
    eltCount = 0 ;
    public void startElement(String name,Attributes atts) {
    eltCount ++ ;
    public void endDocument() {
    System.out.println("Total number of elements: " + eltCount) ;
    }

    Here is my classpath now
    set CLASSPATH=%JAVA_HOME%;%JAXB_LIBS%\jaxb-api.jar;%JAXB_LIBS%\jaxb-ri.jar;%JAXB_LIBS%\jaxb-xjc.jar;%JAXB_LIBS%\jaxb-libs.jar;%JAXP_LIBS%\jaxb-api.jar;%JAXP_LIBS%\endorsed\xercesImpl.jar;%JAXP_LIBS%\endorsed\xalan.jar;%JAXP_LIBS%\endorsed\sax.jar;%JAXP_LIBS%\endorsed\dom.jar;%JWSDP_LIBS%\jax-qname.jar;%JWSDP_LIBS%namespace.jar;.
    It still doesn't work. The pakages that it is complaining about comes from sax.jar which is already in classpath. Can anybody please help.
    TIA

  • TS3694 Can not anyone to my way of Haytnos Hfalfon for a long time error 3004

    Can not anyone to my way of Haytnos Hfalfon for a long time error 3004

    Read here: http://support.apple.com/kb/ts3694#error3004
    Error 3004: If you are using a Mac, you may be able to resolve an error 3004 by quitting iTunes and using the following command at the command line: dscacheutil -flushcache

  • Pls suggest Online docs for 1Z0-051

    I am new to the forum and trying to get online Documentation for first exam in the track...Can somebody pls suggest online help and sites related to the OCP..?
    Edited by: user10997331 on Apr 10, 2009 1:02 PM

    Please read:
    1) The forum faq (announcment stickey post at he top of this forum) [http://forums.oracle.com/forums/ann.jspa?annID=794]
    2) The certification blog on [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=39]
    3) The oracle certifiaction site has lots currently on [http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=39]
    (View all certifications and drill down to a certifaction or exam), you should be able to find the exam topics.
    4) Search in this forums for posts on 1z0-051.
    5) If you are serious about Oracle also take time to become familar with the Oracle Technology website [http://www.oracle.com/technology] which has links to documentation and tutorials and other resources.
    6) IMPORTANT: Some 'online docs' you may find, or are directed to, or may be offered (particularly braindumps), may be unauthorised materials and using them could end up with you losing credit for any exam/certification you may take.
    Hopefully you will find these references and places to search useful.
    Rgds - bigdelboy.
    Edited by: bigdelboy on 10-Apr-2009 14:39 - did not notice hsawwan had replied earlier and given a good reference.

  • Whats the reason for taking more time

    Hi,
    I'm into production support, previously all loadings are fine from the past one month there is a problem in many infopackages taking more time for same no of records, normal wait time is 1 hr, but it is taking 2 to 3 hrs to complete.
    Can any body tell the reasons for this and any resolutions will be a graet help for me.
    Thanks in advance.
    Siddhu

    HI,
    Try to analyse those cube for which loading is taking more time by RSRV Transaction especially see whether dimension table size is more than 20% of fact table size.
    Another reason might be the Table Space Problem or also ask ur basis guys about the Redolog management , ask whether there is enough space while peak loading is going on....
    Assign points if helps....
    Regards,
    VIjay.

  • Reason for ORA-00600: internal error code, arguments: [kkslpco-peek], [], ?

    In my Production DataBase , I am getting ORA-600 error in Alert log file.
    Already , i have applied the patch 10.2.0.4.0.
    Still, the database is throwing that error.
    What is the reason for this error and how to resolvw this error?
    Following is the alert log file error?
    Wed Jul 16 10:33:30 2008
    Errors in file e:\oracle\admin\udump\rbidev_ora_640.trc:
    ORA-00600: internal error code, arguments: [kkslpco-peek], [], [], [], [], [], [], []
    Wed Jul 16 10:33:37 2008
    Errors in file e:\oracle\admin\udump\rbidev_ora_640.trc:
    ORA-00600: internal error code, arguments: [kkslpco-peek], [], [], [], [], [], [], []
    Wed Jul 16 14:12:45 2008
    Errors in file e:\oracle\admin\udump\rbidev_ora_7960.trc:
    ORA-00600: internal error code, arguments: [kkslpco-peek], [], [], [], [], [], [], []

    hi
    this is a generic error
    search in metalink...
    and if not Raise a SR suggested to you ........
    CHeers

  • "You are opening the application----- for the first time"  error

    I've seen a few people post about this from as far back as 2005 but I haven't found anything that worked for me. I believe I started having this problem after upgrading to Snow Leopard.
    When opening an application, most often Microsoft Office by opening a specific document/file, I get the warning that I'm opening the application for the first time. This is mostly an annoyance but I don't know how to get this error to stop coming up. I saw a suggestion to delete caches and make sure the application was set as default for that file type; these haven't solved the problem yet.
    Thanks!!

    Thanks for the reply, unfortunately I'm not sure it helped. I did recently trash a couple caches, but this was after the problem had started. I found an old post that suggested the cache might be corrupted and that it would be a good idea to trash it.
    The link you posted notes that the deleted cache could cause that problem, but I would think a new cache would be created and it would be resolved. Is it possible I have a setting that's erasing it? How would I change that? It also sounds like in the link you posted that theMacMac's problem eventually went away without explanation.

  • Pls suggest right BAPI  FOR  Tcode(MSC2N)

    Hi All,
    I am uploading the data(characteristic values) through the Tcode MSC2N When I am trying to do this through bdc it's not allowing to change characteristic values?What will be the problem?we can use the BAPI BAPI_OBJCL_CHANGE but this bapi will only change the characteristic values but I also need to change date1 field(this is there in the Basic data2in the same transaction MSC2N) Can any body suggest how to do this please?
    Thanks&Regards
    Mahesh

    Hay Mahesh
    Try with the following BAPI's
    BAPI_OBJCL_CREATE              Classification BAPI: Create Assignment
    BAPI_OBJCL_CREATE_KEY          BAPI for Classification: Create Assignment (Key)
    Thanks & regards
    Sreenivasulu P

  • Pls suggest a book for OCP DBA

    Hello friends,
    I wanted to take Oracle database administrator certification exam(OCP)
    Can anyone please suggest me which book i can use. i have very little experience
    in oracle..
    thank u
    karthik

    Hi
    You can start with the installation and config guide for e sourcing application.Also scripting and workflow guide would provide you a lookin to the technical aspects. Follow the below mentioned links:
    http://help.sap.com/saphelp_sourcing_70_p/helpdata/en/39/8ee60a3d74482e9e0111c46dc1e23d/frameset.htm
    https://websmp106.sap-ag.de/support
    Regards
    Mudit Saini

  • Pls suggest a app for transfering pics with serial num: as in my pc to enable search option!

    hie,
    i bought this new ipad for my enterprise, i have several jewelery folders in my pc, which i thought i will be able to transfer in the same way into ipad,
    but i observed now, that into ipad, all the photos from pc gets transfered all in one without any serial number/lable/title.
    & on ipad it doesnot have any search icon on the top to enter a desired number.
    can someone please help with what could be a solution, or which applicztion would best suite my problem.
    i would like all the photos transfered with serial number the same as in my pc. & to enable myself to pick a specific numbered photo at once without going to scroll down the ipad looking for that specific photo.
    awaititng to hear form everyone with a best solution.
    thanxs
    tonymamiya

    It turns out that I may have not waited enough time for the wipe of all of my existing calendar appointments to sync through.
    I created a few more in outlook, deleted them, checked via the office 365 web calendar they were deleted.
    Then I waited another 15 minutes, created the Exchange/Office365 account from scratch, and magic I appear to be back!
    (until something else goes wrong that is)

  • HT1349 I can no update my itunes for some reason for the first time having issues nothing happens

    I've never had an issue before with updating itunes, but this time, there is an update available and it will not update it. Nothing happens. Everything else in iTunes appears normal as far as apps are there, songs, tones etc... that I've recently purchased. I want to update iTunes then sync my phone. Well, I went ahead and tried to sync my phone without updating iTunes and when I connected my phone I get this message.
    "iTunes could not connect to this iPhone because an unlnown error occured (OxE80000001)"
    I'm clueless as to what is going on. I've rebooted my computer and that is all.

    see your error code here http://support.apple.com/kb/TS3221  follow instructions to resolve.

  • No Reason For Disk Too Slow Error, any ideas?

    Ok,
    So I've used Garageband for years from iLife 06 and up and I've never had an issue with any Garageband until now. Here's the deal, I still get the disk too slow error, and there is no explanation. Below is my computer config:
    COMP I'M USING:
    Macbook Pro 13 inch
    OS X Mavericks
    Intel Core 2 Duo (1st unibody)
    4 GB of RAM MAX
    BRAND NEW Hybrid 7200 RPM Drive Installed 500GB total, 300 GB FREE
    NO Other programs are open.
    I use Garageband for recording songs but mostly now for recording podcasts. So the track I am using is normally 1 hour in duration. I can't seem to skip around, from minute 1 to minute 54 and edit at my whim without beach ball and timeing out getting the disk to slow error I never had this issue before, I either get the disk to slow error when trying to navigate large gaps of time in the podcast as I said earlier or even during RECORDING a podcast it'll simply say disk to slow, stop recording and occassionally say there are too many tracks in use, when I only record using 1 track of audio.
    How can this be possible? Even my old G4 allowed me to jump all over the timeline with no issues. It seems there is some kind of flaw in the software. And yes, I just restored OSX Mavericks to my brand new Hybrid Hard drive, so there's no explanation as there are no disk errors or permissions errors of any kind.
    I'd rather not hookup an external drive to record too as that seems silly when I've never had too before. If this "modern" computer can't do something that my old G4 ibook can do, don't you think we're going in the wrong direction with this program?
    I've heard of so many people having this issue, and I thought upgrading my OS and getting a new HD would help but it hasn't. I'm at wits end with this issue.
    Any advice would be helpful, thank you.

    There are a few other reports of problems with 10.6.7
    Some audio device(s) inputs have ceased working, a few disk to slow messages...etc. I don't see the wisdom of upgrading a working DAW system if that's it main function. OSX has to support a lot of different hardware now, many, many Intel motherboard and/or processor revisions... it's not going to be as smooth sailing as it used to be.
    pancenter-
    Here's a search over the past 90 days.
    http://discussions.apple.com/search.jspa?threadID=&q=Disktoslow&objID=c231&dateRange=last90days&userID=&numResults=15&rankBy=10001

Maybe you are looking for

  • Images not displaying � Vista or Netbeans?

    Hi, I�m developing JSP pages with Netbeans and recently moved it over from windows XP to Vista. Since then any images I add to display via the JSP pages do not appear, only the small red cross placeholder. Any image I added before Vista still display

  • Service PO with service text - Account determination

    Hi experts, When we create Service PO without Service Master, Material Master (Only with service text), how the account determination will happen.  Is there any other way to get the account determination? Regards Mohan

  • Moving AQ$_WF_CONTROL_D as part of a re-org

    DB - 11.2.0.3 - s390/zlinux APP - 12.1.2 - SLES SP2 (Linux x86_64) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ As part of the reorg, there's a table I need to move that wont. (AQ$_WF_CONTROL_D) I've been following note: 418238.1 from metalink which says to shutdown

  • TS2990 after software update gray screen appears and no start

    I have just done a software update but after that the mac is not starting up, its just showing the start up gray screen and then shuts down, please advice how to start it and bring to normal.

  • Unable to edge up due to website error

    I am attempting to edge up two lines on my plan, and keep receiving the following error: There was an error with one of our systems and we're working on it now. We're sorry for the inconvenience. Please try again in a few minutes. Any chance of getti