Why this simple inheritance issue occour

public class A extends B
     private Object lock=null;
     public A()
          super();// super intiallized
Err:          lock=super; //givin error on this statement
i m getting on above Err statement Error is
'.' expected at line 57 (57:28)
why is so is it not possible to assign super class to some other class in subclass
how to solve this problem .and why it occour
i also try this statement as
lock=(Object)super;
but same error occours
Thanks

super doesn't work like you would expect it to in the case of assignment. super isn't a reference to an object, but rather a mechanism for accessing inherited methods or fields.
Try using the following
lock = super.clone();Cheers,
Cypher

Similar Messages

  • Why this simple assingment is not possible in Generics ?

    Hi
    Just curious to know why this simple conversion does not work and requires casting ?
    List<? super Integer> list = new ArrayList<Integer>();
    List<? super Number> listN = list; //Requires Casting
    List<? extends Number> listExNu = new ArrayList<Number>();
    List<? extends Integer> listExIn = listExNu; //Requires CastingAs per my understanding ,
    A List<? super Number> can fit inside a List<? super Integer> ...
    So what really happens here to force casting ? Any ideas ?

    ejp wrote:
    List<? super Integer> list = new ArrayList<Integer>();The only two classes that are superclasses of Integer are Number and Object.Not quite. Please note that the clause *? super Integer* is inclusive, i.e. it also matches List<Integer>.
    Additionally, it matches all interfaces implemented by Integer. Thus, the following types can be assigned to list:
    List<Integer>
    List<Serializable>
    List<Comparable<Integer>>
    List<Comparable<? extends Integer>>
    List<Comparable<? super Integer>>
    List<Comparable<? extends Number>>
    List<Comparable<? extends Serializable>>
    List<Comparable<?>>
    List<Number>
    List<Object>And the following types can be assigned to listN:
    List<Serializable>
    List<Number>
    List<Object>Since the latter is a genuine subset of the former, an implicit conversion such as listN = list is impossible.

  • Simple? can anyone tell why this simple btn doesn't work?

    Trying to write my own simple disabling button class (with
    some help from friend - thanks LuigiL)
    So, why does my button not turn off when clicked? it runs the
    deinitializeBehavior function but the removeEventListeners are not
    actually being removed...
    I don't know why but could this possibly be a graphics issue?
    Thanks in advance

    HAH! OK - I am starting to get this a little.
    Thank you St. LuigiL. You are my Obie-wan: the force is
    strong with you.
    I made a Main.as document class and now the whole thing works
    like a charm! I was wondering if it was necessary to do so - and it
    was.
    In my OCD I am constantly striving to keep my classes to a
    bare minimum (if I could write everything on one page I would.)
    I very much appreciate your incredible help and support.
    BAM

  • Why this simple IF - ENDIF is NOT working??

    Hi Experts,
    Am wrting a simple  IF condition with WILD CARD value , in the user exit, as below,
    if xlikp-lgbzo = 'AB'. (pls. notice that, there is WILD CARD in the 'AB' value)
    sy-subrc = 0.
    else.
    sy-subrc = 4.
    endif.
    1) Say, the XLIKP-LGBZO value = AB-01-02 (pls. notice that, there  ' - ' in the value of AB-01-02)
    then, sy-subrc is becoming 4 ?????????????
    2 )Say, the XLIKP-LGBZO value = ZB-01-02
    then, sy-subrc is becoming 4
    the 2nd case is OK, but, Why the 1st case is becoming FALSE?? actuallym it shuld b TRUE, right??
    Is it bcoz of hiphans -  " - "?? but, i tried with WITH OUT hiphans , then also NOT working CORRECTLY??
    thanq

    Hi Srini,
    Try the following:
    IF XLIKP-LGBZO  CP 'AB*'.
    sy-subrc = 0.
    ELSE.
    sy-subrc = 4.
    ENDIF.
    CP - Contains Pattern
    Hope this helps you.
    Regards,
    Chandra Sekhar

  • I don't understand why this simple program will not print.  Help please!!!

    This program runs with no errors, it just doesn't print anything. Anyone have a clue as to why it doesn't print anything?
    Here is my code:
    import javax.swing.JOptionPane;
    public class Converter {
    public static void main(String[] args) {
    int a,b,c;
    int inputNum=Integer.parseInt(JOptionPane.showInputDialog(null," Enter a length in yards: "));
    String measurement = JOptionPane.showInputDialog(null,"Enter the unit of conversion (inches, feet, or centiyards): ");
    if (measurement == "inches"){
    a = inputNum*36;
    System.out.println(a + "inches");
    else if (measurement == "feet"){
    b = inputNum*3;
    System.out.println(b + "feet");
    else if (measurement == "centiyards"){
    c = inputNum*100;
    System.out.println(c + "centiyards");
    }

    Don't confuse String's equals() method with the equality operator '=='. The == operator checks that two references refer to the same object. If you want to compare the contents of Strings (whether two strings contain the same character sequence), use equals(), e.g. if (str1.equals(str2))...
    Example:String s1 = "foo";
    String s2 = new String("foo");
    System.out.println("s1 == s2: " + (s1 == s2)); // false
    System.out.println("s1.equals(s2): " + (s1.equals(s2))); // trueFor more information, check out the Java FAQ
    ~

  • Why this simple 'IF' syntax is not working?

    Hello
    Pls. help me that,
    var myObject = /TextField11/
    var greyFieldsList = "TextFieldAA TextFieldBB TextFieldCC "
    var ReqFieldsList = "TextField11 TextField22 TextField33 "
    var returnValue = greyFieldsList.search(myObject);
    var returnValueReq = ReqFieldsList.search(myObject);
    if (returnValue != -1) {
    this.fillColor = "192,192,192"; //GREY
    this.access    = "readOnly";
    else if (returnValueReq != -1)
    this.fillColor = "255,255,191";  //YELLOW
    else
    // do nothing
    Yellow is not working at all!!
    Grey is working some times, some times not!
    Pls. correct my IF condition in such a way it shoud work.
    At given point of time, any field possess only one color
    Thank you

    Hi Srini,
    Try the following:
    IF XLIKP-LGBZO  CP 'AB*'.
    sy-subrc = 0.
    ELSE.
    sy-subrc = 4.
    ENDIF.
    CP - Contains Pattern
    Hope this helps you.
    Regards,
    Chandra Sekhar

  • Why this simple code doesn't work?????

    i get error "java.sql.SQLException: Operation not allowed after ResultSet closed "
    try{
                Class.forName("com.mysql.jdbc.Driver");
                Connection dbcon = DriverManager.getConnection("jdbc:mysql://localhost:3306/db?user=user&password=pasw&useUnicode=true&characterEncoding=utf-8");
                String query = "SELECT * FROM  data where parent_id='xxsds^1'";
                Statement statement = dbcon.createStatement();
                ResultSet rs = statement.executeQuery(query);
                while(rs.next())
                    String name = rs.getString("name");
                    String query2 = "SELECT * FROM  data where parent_id='"+name+"'";
                    statement.execute(query2);
                    ResultSet rs2 = statement.getResultSet();
                    while(rs2.next())
                        String name1 = rs2.getString("name");
            catch(Exception ex){out.println(ex);}thanks a lot

    You need to use two separate statments if you're going to interleave the queries like that. I'd think you could get by with a single query and a join though, but I didn't actually look at what your queries are doing.
    Also, you should use PreparedStatement, a "?" parameter, and PS's setString method, rather than a plain old Statement where you have to maually handle string quoting.

  • Why this simple vi cannot work?

    I want to use combination of keys 'ctrl+shift+z' as the event source. Could anyone help me to revise it? Thanks in advance!!!
    Attachments:
    try.vi ‏11 KB

    Duplicate Post.

  • In my Macbook Pro, on a few occassions, the apple menu bar blacks out. its displayed as a negative image. The desktop wallpaper get greyed out and i get a blank screen as wallpaper. No idea why this happens. I reset the system and issue gets resolved.

    In my Macbook Pro, on a few occassions, the apple menu bar blacks out. its displayed as a negative image. The desktop wallpaper get greyed out and i get a blank screen as wallpaper. No idea why this happens. I reset the system and issue gets resolved.

    AshwinVC wrote:
    I reset the system and issue gets resolved.
    How? 

  • After installing 3 updates from "software update app" today (june,11th) my MacBook Pro doesn't  initialize anymore. Why this is happening? And how do i solve this issue?

    Hello Mac Friends!
    Need some help here!
    After installing 3 updates from the "software update" app today (June, 11th) my macbook doesn' t initialize anymore.
    Is there someone who can help me fix this issue?
    Why this is happening?
    How can i fix it?
    Wainting some feedback...

    Two places to start with that would have been better:
    MacBook Pro
    https://discussions.apple.com/community/notebooks/macbook_pro 
    https://discussions.apple.com/community/mac_os
    http://www.apple.com/support/macbookpro
    TimeMachine 101
    https://support.apple.com/kb/HT1427
    Lion Recovery Mode
    http://support.apple.com/kb/HT4718
    How to clone your system:
    http://macperformanceguide.com/Mac-HowToClone-backup.htmlhttp://macperformanceguide.com/Mac-HowToClone.htmlhttp://www.macupdate.com/app/mac/7032/carbon-copy-cloner
    If you have backups, if you can and saved your ML installer, you can start over.
    Prevention and taking a more proactive approach to system maintenance and repair, rather than fixiing a problem (likely pre-existing?) format the drive or partition and reinstall 10.8.1 and restore from backups.
    Never had any issues? freezing? apps crashing before?

  • Why is this simple PDF file not searchable?!? Someone please help!!

    Hi all!
    I DESPERATELY need to figure out why this PDF file is not searchable, and how to fix it. It's from a teacher of mine at my university, and basically I want to be able to make all of the PDF's she gives out searchable since there is a lot of content. I'm running Adobe Reader 11, ver. 11.0.10, on an early 2014 Macbook Air running OS X Yosemite ver. 10.10.1. I've tried using the search function, the advanced search function, and I've looked for the option to turn OCR on (couldn't find it)....and none of these attempts have resolved the issue.
    The weird thing about this is I've NEVER had a problem searching thru ANY PDF on this Mac -- including really, really complex lecture PDFs from other professors -- so I can't figure out why these are any different. Is it because this PDF was exported out of a Powerpoint presentation (I think)? Or something else? Does anyone have any ideas?
    Lastly, I'm attaching a screenshot (below) so that if any of you give me any directions ("Look under the [such and such] toolbar"), you can see first exactly what I see.
    THANKS guys for any input and consideration!
    -R

    There are some issues with this PDF file.  It's not tagged but even still it has some real problems.  I checked the file to see what created it and it was something called "Wine Postscript Driver" and the PDF Producer was "GPL GhostScript 9.10"  When you check the file in Preflight then you will begin to understand that this is a poorly created PDF file.  Here is a bit of the PDF Syntax report:

  • I am facing an issue " Denied connection per minute from one ip address" why this error occur and how to resolve it? is it really harmful for my TMG Server or not??

    I am facing an issue " Denied connection per minute from one ip address" why this error occur and how to resolve it? is it really harmful for my TMG Server or not??
    Error Description:
    The number of denied connections from the source IP address 10.0.0.X exceeded the configured limit. This may indicate that the host is infected or is attempting an attack on the Forefront TMG computer. 
    electrifying

    Hi,
    this may be a false/positive log record.
    First check the services and applications on the effecting machine (NETSTAT -ANO) to see which connections the machine has established or tries to establish.
    Check the machine against viruses and spyware.
    if you don't find any viruses / spyware or "mysterious" connections, create a connection exception limit in the flood mitigation settings on your TMG Server:
    http://www.isaserver.org/articles-tutorials/configuration-security/TMG-Firewall-Flood-Mitigation-Part1.html
    regards Marc Grote aka Jens Baier - www.it-training-grote.de - www.forefront-tmg.de - www.galileocomputing.de/3276?GPP=MarcGrote

  • Why does my iCal delete all events older than a year? Is this a synch issue? I'm running Snow Leopard.

    Why does my iCal delete all events older than a year? Is this a syn issue? I'm running Snow Leopard.

    this has already been answered.
    please ignore my question.

  • HT201263 I'm so disgusted! I just realised I will lose the photos of my daughter's birth... And why??? because I pushed a stupid button for a software update???? Apple,..I need a solution. I haven't paid this device to have this kind of issues.

    I'm so disgusted! I just realised I will lose the photos of my daughter's birth... And why??? because I pushed a stupid button for a software update???? Apple,..I need a solution. I haven't paid this device to have this kind of issues.
    My Iphone is still in the recovery mode and I don't know if there is a way to restart it without losing my photos? I made the last backup months ago...:(((

    I'm a little confused. At what point did the phone go into Recovery mode? Did you just leave it alone for awhile after you clicked the update button? I just updated my phone, and after the initial download, the phone restarted itsef a couple of times, installing the update in the process. When you do an update, you need to leave your device alone until it is completely done.
    As far as your photos go, sorry, but if you have not backed them up, and you are truely in Recovery mode, then you won't have any way to restore them.
    Are they in your Photo Stream in iCloud by any chance?
    If not, and you have to do a Recovery, then you won't be able to restore them from a backup.
    But if they were so important, why wouldn't you have backed them up?
    You cannot blame Apple for this. What if your phone had been stolen, or you had lost it? You would be in the same boat - you would lose your photos.
    So, two things:
    Are you sure your phone isn't just completing the update? Have you let it do it's thing for 20 or 30 minutes? If not, leave it alone and see if it is in the same condition in 30 minutes.
    If you have, then determine if you have those photos in your Photo Stream. If you do, then they should still be there when you restore your device and sign back onto iCloud.
    Cheers,
    GB

  • Can you please help me with this simple (not for me:) issue

    Why this doesnt work?
    public void spl ()
         String a=("moon.sun");
    String [] f=a.split(".");
    System.out.println(f[0]);
    }

    The second expression to split() is a regular expression. A period in a regular expression matches all characters, and you're wanting it to just match a period.
    To match just the period for your split, you'll need to escape it:String[] f = a.split("\\.");

Maybe you are looking for

  • Receiver JDBC

    Hi the receiver JDBC structure                                                                    occurence <statement1>   ----------------------------->                   1..unbound    or    1..1                               (1) <Table>           

  • When in Adobe Bridge and trying to create a web photo gallery, under the windows menu and then the workspace menu there is no output option.  Where is it?

    When in Adobe Bridge and trying to create a web photo gallery, under the windows menu and then the workspace menu there is no output option.  Where is it?

  • Classification

    hi what is the differnce between material class (001) and class type (300) configurable class Question 2 suppose  i want to create material master of car and i have variants of this car like maruti 800 black colour maruti 800 silver colour and while

  • How to set up 'Tansport Request'  to move Configuration Change to Prod ?

    I would like to know the steps to transport the Configuration Changes  from Development to QA (or Production). Thanks for your help.

  • Idvd - image not found

    i just made a video with imovie and would like to burn it as a dvd. but my idvd is not there. i did not delete it. the icon is still there. i included the error from the problem report. i use ilife '08. please help.... sara Version: ??? (???) Build I