How the program work ???

hi everyont i am doubt about how the program work???
public class TestClone implements Cloneable{
     int count;
     TestClone next;
     public TestClone(int count){
          this.count=count;
          if(count>0)
          next=new TestClone(count-1);
     void add(){         
     count++;
     if(next!=null) // how it can loop and
     next.count++; //execution next.count++ ??
     public String toString(){    // from the result  the object execut  the method  automatic, but i think  it isnot  definite as static ,it cannot execut
          String s=String.valueOf(count)+"";
          if(next!=null) //the same question as about
          s+=next.toString();
          return s;
     public Object clone(){
          Object o=null;
          try{
               o=super.clone();
               }catch(Exception e)
               {System.out.println("cannot clone");}
               return o;
public static void main(String []args){
     TestClone c=new TestClone(5);
     System.out.println("c="+c);
//the result is 5 4 3 2 1 0
//c is object why it can print out
     TestClone cl=(TestClone)c.clone();
     System.out.println("c="+c);
     c.add();
     System.out.println("after added\nc="+c+"\ncl="+"cl");
//the result is 6 5 3 2 1 0 but where is 4 ??
// 5 4 3 2 1 0
     }     }

Is this your code? What do you WANT it to do? What's the purpose?
Thanks!
-Zach

Similar Messages

  • How the Spice Works: Liz Trinh, Community Tester extraordinaire

    As one of our community Test Engineers, Liz Trinh embodies all things Spiceworks. She's got a fierce eye for detail, a drive to keep things on track, and a laugh that shakes things up. Born and raised in Houston, Liz graduated from The University of Texas, Austin, with a computer science degree. After a friend pointed her toward a place renowned for its love for the color orange (hint: It's us!), Liz started working her magic testing superpowers at Spiceworks about two years back. Since then, she has left a trail of awesomeness in her wake by working with developers to improve the community. She even won an Honorable Mention at her first SpiceWars! (If you don't know what Spice Wars is, you're in for a treat.)(Fun fact: Liz claims that she originally wanted to be in advertising, working as a graphic designer. After discovering that her...
    This topic first appeared in the Spiceworks Community

    A 30 second screencast that shows a demo of how to get up an running
    might be a good thing to get people hooked on.
    Just saying ;)
    Ketan
    http://ketan.padegaonkar.name | http://eclipse.org/swtbot | @ketanpkr
    On 4/1/11 1:39 PM, Geoff Bache wrote:
    > Hi all,
    >
    > I've released a new version of my free open source GUI test tool
    > PyUseCase, which has in this version gained support for SWT/Eclipse RCP
    > by using SWTBot. Many thanks for a great tool to build on top of :)
    >
    > Explanations and homepage:
    > http://www.texttest.org/index.php?page=ui_testing
    >
    > Step-by-step tutorial (not using SWT, but illustrating how the tool
    > works) at
    > http://www.texttest.org/index.php?page=documentation_3_21&am p;n=gui_tests
    >
    > The point of PyUseCase is to combine the ease of recording tests
    > directly from the UI with the maintainability of having tests defined in
    > a high-level domain language defined by the tester. The ultimate aim is
    > to allow non-programming testers to create and administer their own test
    > suite with minimal fuss and without having to rely on others to create
    > test code for them. Having domain-language tests and no test code is
    > also useful even if you are a programmer in my experience...
    >
    > For those that groan at the mention of the word "recorder", rest assured
    > this is nothing like any recorders you've seen before :)
    >
    > This is the first version of PyUseCase to support testing of
    > applications written in a language other than Python. The SWT support is
    > probably beta status for now, and it doesn't yet handle all widget types
    > that SWTBot supports. Would love to get feedback from anyone trying it out.
    >
    > Regards,
    > Geoff Bache
    >
    >

  • I installed lion on my MB '08. Since then, the machine stocks form time to time. sometimes three or four times a day. Due Lion is an app as well I would like to uninstall it to try how the machine works. How can I uninstall Lion from my MacBook '08 ?

    I installed lion on my MB '08. Since then, the machine stocks form time to time. sometimes three or four times a day. Due Lion is an app as well I would like to uninstall it to try how the machine works. How can I uninstall Lion from my MacBook '08 ?

    Restore the backup you took before the upgrade.
    Allan

  • Report RFKABLOO i want to know how the layout works

    Hi all,
    in report RFKABLOO i want to know how the layout works.
    like it has a parameter layout in which if we select 5 fields
    it shows 5 in print screen output.
    what is the process and how it works in this report?

    Why not you use the Debugging option?
    Do not expect others to work for you.
    Also do not post a thread more than once in the forum.
    Read the [Forum Rules|http://wiki.sdn.sap.com/wiki/x/FgQ] before posting more.
    Regards
    Karthik D

  • How do I learn how the sidebar works in Mail?

    I have added 5 accounts but I can't make sense of why certain things are in certain areas. For example, what's the difference between Mailboxes and On My Mac? I was excited to move towards managing all my email in one place.
    I have numerous questions and rather than write them all down here, I'd just like to know where I can learn more. Even just know which OS X version added this particular sidebar might help.
    I have spent about 2 hours searching Apple.com, Lynda.com, YouTube and other sources to find a tutorial to describe the details of the sidebar, but I can't find anything useful. Everything is for newbies and I'm actually an advanced email user -- except that I'm confused as to how the sidebar works.
    Suggestions, please. Thank you!
    In gratitude,
    Karyn

    Drag the divider between the message list and the preview pane all the way to the right. It will pause about a 3/4 of the way, but keep dragging and it will go all the way over.

  • How the balance works for http/https in CSS?

    I want to understand how the balance works for http/https in the CSS.
    As per doc,
    - http/1.0=single URL per TCP connection
    - http/1.1=persistent connection.
    Q1. my understanding is http is stateless connection so needs TCP session for each URL. how the http/1.1 works with persistent. keep the same TCP session for a multiple URL request?
    Q2. https is using single URL and continue processing until terminate the https instead of open another URL in the middle of transaction. in this case, I think the client can stick into same service based on the assumption the CSS support persistent. if then, no advanced sticky(ex, srcip) required?
    Q3. looks below both are analogy. what's difference between them?
    - balance srcip(same src IP to the same service)
    - advanced-balance sticky-srcip
    Q4. what's balance decision mechanism for "balance roundrobin" to distribute evenly? ex, in case of multiple URL request coming from same client. evenly distribute URLs?
    Regards,

    Hello,
    first let me clarify 1 point.
    HTTP/HTTPS are standards that are defined in RFC.
    For HTTP/1.1 you can check the following RFC
    http://www.faqs.org/rfcs/rfc2616.html
    Therefore, the behavior of HTTP 1.1 is not defined by the CSS.
    Q1- HTTP/1.1 simply keeps 1 TCP connection to send a received mutiplie HTTP request/response.
    HTTP/1.0 will open 1 TCP connection for every HTTP request.
    Q2- HTTPS is just HTTP over SSL.
    So basically the same rule as above applies.
    HTTP/1.1 can use 1 SSL connection for many HTTP request/response while HTTP/1.0 will use 1 SSL connection for each HTTP request.
    Therefore, if you have customer using HTTP/1.0 you need some form of stickyness to guarantee that every connections will go to the same server.
    Even if only using HTTP/1.1 you may need stickyness.
    A user could disconnect and reconnect and require to be loadbalanced to the same server as before.
    Q3- There is a big different between balance srcip and sticky-srcip.
    The balance srcip simply hash the source ip address to find the destination server.
    The problem of this method is that the loadbalancing is not guarantee to be evenly distributed between the servers.
    With sticky-srcip, you use a normal balance method like round-robin, and then you create a sticky entry in a sticky table.
    Next time this user comes back we first check the sticky entry to find the destination server.
    The advantage is that it guarantess your users will be evenly distributed among the server.
    Q4- roundrobin is applied to connection - not url [by default].
    So if you have 2 users and they both open 1 connection, the CSS will send 1 connection to 2 different servers.
    So each server has 1 connection.
    If one user sens 10 URL and the other 1 sends only 1, one server will have 10 url to process while the other only one.
    That's if you are using HTTP/1.1 and use persistent mode on the CSS.
    You can break persistency and split the url.
    I run out of space and time to explain you everything.
    I suggest you go read the RFC or a book on HTTP.
    Also read the CSS configuration guide.
    There is much more you need to know if you want to take full advantage of the CSS like cookie, ssl offloading, L7 rules vs L3/4 rules, ...
    Regards,
    Gilles.

  • Every time i try to start itunes it trys to backup my ipad and says an error stopped the program working and closes down??

    Every time i try to start itunes it trys to backup my ipad and says an error stopped the program working and closes down??

    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!

  • Why do i have to keep clicking my left mouse button to make the program work it just stops and if left click it starts working

    Why do i have to keep clicking my left mouse button to make the program work it just stops and if left click it starts working. I'v only just started to use this program and It's no good at all if I go to a website and click a button I have to keep clicking it to finish what its doing.

    hello jeffsprig, can you try to replicate this behaviour when you launch firefox in safe mode once?
    [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    multiple other affected users have reported that this was an issue caused by malware on their pc. please run a scan of your system with [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] and the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes].
    [[Troubleshoot Firefox issues caused by malware]]

  • How the sendBytesLong works?

    Hi,
    The sendBytesLong() that helps to send longer data response
    For sending large byte arrays as response data, the APDU class provides a special method sendBytesLong() which manages the APDU buffer.
    Could you clarify how it could help the transmission? And how i should understand the term "manage" stated above that i quoted from API doc?
    thanks,
    -Hoang Long

    safarmer wrote:
    Considering you cannot set the outgoing length to more than the single response APDU length, you cannot set the length to the full buffer and keep calling send in the way you mentioned. You need to return from your process method (with the appropriate SW) before the card can receive a GET RESPONSE message. You need to be able to then receive another APDU and handle it appropriately as this will be a new call to your process method. You can then send the next piece of data and return again and repeat until all data is sent.
    You can search the forum for recent posts that reference code I posted as an example for APDU response chaining.
    Cheers,
    ShaneHi Shane,
    I thought that the advantage of "sendBytesLong(...)" method is to send data in working buffer larger than APDU buffer as you mentioned earlier. But according to the code you mentioned, applet dev still have to manage the data being sent with max length is the length of APDU buffer:
       // work out how many bytes to send this time and how many will be left
            short remain = (short) (fileSize - offset[OFFSET_SENT]);
            boolean chain = remain > MAX_APDU;
           short sendLen = chain ? MAX_APDU : remain;
            // Get ready to send
            apdu.setOutgoing();
            apdu.setOutgoingLength(sendLen);
            apdu.sendBytesLong(fileBuffer, offset[OFFSET_SENT], sendLen);
    I seems that i misunderstood how the sendBytesLong works?
    thanks,
    Edited by: CardM on Jul 10, 2011 6:51 PM
    Edited by: CardM on Jul 10, 2011 6:58 PM

  • Everytime I try to open a creative cloud product, the program closes. I need to use both illustrator and indesign for school and I was wondering if anyone had any advice on how to actually make the program work?

    If anyone has any advice on how to make creative cloud programs work please let me know!
    Any help is appreciated.

    These questions below may be for a different product... but the KIND of information you need to supply is the same, for the products you use
    More information needed for someone to help... please click below and provide the requested information
    -Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840

  • Trying to understand how the DDK works

    Hi,
    1.)  If I wanted to be able to use a wide variety of NI DAQ cards
    under the QNX RTOS, would the NI Measurement Hardware DDK be able to
    faciliate this?
    2.)  From looking at the web-page describing the DDK, it looks to
    me that the driver code written by NI is done in a platform indepedant
    way, using only ANSI C/C++ function, and when it needs
    to do something platform specific, it calls out to functions that I can
    provide.  Is this correct?  I am envisioning having to
    provide code to get PCI resources, attach to interrupt, hw I/O.... am I
    on the right track?
    3.)  I've downloaded the NI HW DDK OTHER code, but it's not clear to me
    how the platform-dependant code for QNX will integrate with this.  I
    have the DAQ PCI_E_series Register Level Programming Manual
    and STC manual, but I can't find any docs on how to use the code in
    this archive.  What am I missing?
    Thanks

    Hi,
    1.)  If I wanted to be able to use a wide variety of NI DAQ cards
    under the QNX RTOS, would the NI Measurement Hardware DDK be able to
    faciliate this?
    Depends.  MHDDK provides register information for a number of NI
    DAQ devices.  There isn't an API that abstracts the measurement
    task form the hardware, like DAQmx does.
    You would need to write the high level functions for each type of
    device you what to use and provide an API to your application that
    would select the appropriate device specific function.  I guess
    something like
    startDevice()
        // somehow get deviceTypeId
        switch (deviceTypeId)
        case kMSeries:
              mseries_startDevice();
        case ESeries
              eseries_startDevice();
    or using function pointers, or c++ inheritance.  There are many possibilities...
    2.) .... am I
    on the right track?
    Yes.  MHDDK only abstracts device access using the iBus and
    tAddressSpace objects.  The iBus contains the address spaces of
    the device.  You request address spaces from the bus and use it
    write/read from the device.  For PCI devices the read/write
    functions using pointer manipuilation.  For a PCMCIA device on a
    x86 you would use the port io instructions.
    iBus objects are created and destroy using the factory methods
    acquireBoard() and releaseBoard().  This is where all the platform
    dependent magic should occur.  Here are a couple of KBs with more info:
    Measurement Hardware Driver Development Kit Register Level Programming Architecture
    How to Make an iBus
    3.)  I've downloaded the NI HW DDK OTHER code, but it's not clear to me
    how the platform-dependant code for QNX will integrate with this.  I
    have the DAQ PCI_E_series Register Level Programming Manual
    and STC manual, but I can't find any docs on how to use the code in
    this archive.  What am I missing?
    In  osiUserCode.cpp, implement acquireBoard(tChar*) and
    releaseBoard(iBus *&).   To acquire the board you usually
    have to loacte the device, find bar0 and bar1 , and map them to the
    current address space. 
    This article shows exactly how to do that in QNX: Talking to hardware under QNX Neutrino
    Also, create a QNX specific structure to
    attach to the iBus where you can store any handles you need for
    releaseBoard() to clean up.
    Hope this helps.
    Diego

  • How the Connector works inside ?

    Hello,
    now I got a sample with a BAPIRET2 table and it is working, but I have a general question to integer types. I saw that the field "ROW" is an ..._INT (INT4) and has a 4 byte length exactly how the byte store in memory. The ABAP dictionary says a length of 10. Think I'm right, that this length is only for the display ? A next point is that the offset can't be direct calulated as offset + length = offset of next field ?! in case of the field "ROW" there are 2 undefined ? bytes after the "PARAMETER" field. "PARAMETER" starts at 470 with a length of 32, so I was thinking "ROW" has an offset of 502, but in the working code I got 504 ! Why ? Will be the integer aligned to a 4byte range ? Or why there are 2 additional bytes before the "ROW" field ?
    Regards
    Holger

    Holger,
    I am going to try to help. Not 100% sure what you are asking. Here is what I know.
    Within .NET you need to declare a variable that is a new instance of the BAPIRET2 table. Something like (I will use vb code....easier to read)
    Dim retTable2 as new BAPIRET2
    After returning the value from a function you need to loop through the table and read the values. Something like this
    For i as integer = 0 to retTable2.Count - 1
           Dim param as string = retTable2(i).parameter
           Dim row1 as integer = convert.toInt32(retTable2(i).row)
    Next
    I think I have the syntax correct. I am not in front of a .net right now to verify. I hope this may help answer your question.

  • Hi, so I'm wanting to buy After Effects CS6 and I have a MacBook Pro 15 inch, will the program work? If not what which After Effects version will?

    I'm saving up to buy After Effects CS6 and I wanted to make sure the program will work on my Macbook Pro. I have the 15 inch screen. If that version doesn't work is there another version that will work with it?

    Yes, After Effects CS6 will work on a MacBook Pro.
    I see in your sig that it says that you're still using Mac OS X v10.5.1. Really? Because that would be a problem. After Effects CS6 requires v10.6.8 or higher of Mac OS X.

  • How the callback works in the events?

    Hi,
    I am in doubt that how the callback will occur internally?
    Consider i am having one delegate and one static event for it. 
    Ex:
    public delegate void raiseDelegate(String someDesc);
    public static event raiseDelegate callComlpetedEvent;
    And also Consider i am having 2 projects namely BMLayer and UILayer and all these above delegate and events are declared in the BMLayer and i having the reference to the BMlayer in the UILayer and "not vice versa".
    Now i am subscribing to that event in one of the class which resides in the UILayer. And i am raising the callCompletedEvent somewhere in the BMLayer
    and i am having the hit in the UILayer where i have subscribed.
    My question is:
    1. Whether the BMLayer's event will keep track the list of the subscriprions in the UILayer. If yes my another question is,
    i did not add any ref of the UILayer in the BMLayer. Then how the BMLayer will communicate back or how it will keep track of those callls.
    2. Or simply the UILayer will have the eye on that event which is in the BMLayer and automatically call the callback method.?
    Or any other point is happening?
    May i kindly know how it is working.!?
    Thanks in advance,
    NANDAKUMAR.T

    1. Yes BMLayer event will keep track of the list of subscriptions. It need not to know about the subscribers as only way UILayer or any other dependent layer can subscribe is to provide method with same signature of "raiseDelegate" delegate. So
    it always know how to call.
    You can assume event as list of method which BMLayer will call once the event is raised
    2. UILayer will no have eye on event, BMLayer automatically calls the callback method.

  • Good resources for understanding how the internet works

    Hi everyone,
    I got quite a lot of spare time at my hands these days, so I thought I might learn about how the internet (and networking in general, after all I'm using the internet daily, and I've even programmed with Java sockets for ages)! Specifically, I'm probably talking about the OSI model and its components.
    Historically, reading Wikipedia entries doesn't quite cut it for me, I tend to get the hang of things a lot easier with a book. So, if you know a good book (though a good online guide / explanation is fine, too), please let me know!
    Cheers,
    - Allan

    At my uni, we use "Computer Networking: A Top-Down Approach" by James Kurose and Keith Ross for all our networking classes.  I wholeheartedly recommend it; it's clear, approachable, and something you'd want to read if you didn't have to read it.

Maybe you are looking for