Reason for this output

i need to know that why this code is giving the following output..what's the flow of control.......
public class ThreadPrint {
static synchronized Thread makeT(final String id,boolean d)
{Thread t=new Thread(id) {
         public void run() {System.out.println(id);
//      System.out.println("hi" + ":" + id);
//t.setDaemon(d) ;
t.start();return t;
public static void main(String s[])
Thread a=makeT("A",false);
Thread b=makeT("B",false);
System.out.println("End");
output:
End
A
B

A: reason for this output

liz,
Try to explain this one...
package forums;
public class ThreadPrinter {
  static synchronized Thread makeThread(final String id,boolean d) {
    Thread t = new Thread(id) {
      public void run() {
        for(int i=0; i<10; i++) {
          System.out.println(id+" "+i);
    t.start();
    return t;
  public static void main(String s[]) {
    Thread a=makeThread("A",false);
    Thread b=makeThread("B",false);
    System.out.println("End");
}produces
Test 1
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
End
B 0
B 1
B 2
B 3
B 4
B 5
B 6
B 7
B 8
B 9Test 2
End
B 0
B 1
B 2
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
B 3
B 4
B 5
B 6
B 7
B 8
B 9Hmmm... vely intarasting :-)
Keith.

liz,
Try to explain this one...
package forums;
public class ThreadPrinter {
  static synchronized Thread makeThread(final String id,boolean d) {
    Thread t = new Thread(id) {
      public void run() {
        for(int i=0; i<10; i++) {
          System.out.println(id+" "+i);
    t.start();
    return t;
  public static void main(String s[]) {
    Thread a=makeThread("A",false);
    Thread b=makeThread("B",false);
    System.out.println("End");
}produces
Test 1
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
End
B 0
B 1
B 2
B 3
B 4
B 5
B 6
B 7
B 8
B 9Test 2
End
B 0
B 1
B 2
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
B 3
B 4
B 5
B 6
B 7
B 8
B 9Hmmm... vely intarasting :-)
Keith.

Similar Messages

  • What is the reason for this error? after export part of movie broken

    hi, i cannot find the reason for this strange error that happaned to me for the first time, you can see the outcome here:
    http://picasaweb.google.com/p.cardash/IMovieBug/photo#5164317113276584274
    after exporting in imovie to h264 .mov file, from HDV project, resolution is twisted, plus, the part that was supposed to fit hole screen, is black and sometimes with little graphic errors.
    i tried about 10 times, with different setting, resolutions, and other parameteres.
    after exporting for ipod, everything is ok, in m4v format.
    what is wrong? i use the same method for creating and also for exporting, as in previous projects. i didnt use any new transitions, efects nor titles...
    any thoughts?
    best to You,
    Piotr

    ok, i think that i know where is the problem, but i still dont what is it
    ive copied my file to a new mac with just installed imovie and everything is the same,exactly the same output. so 100% positively the problem is within the particular project.
    i didnt check my mackbook with TT, since i dont have it and dont want to pay i thought its for free
    i`ll try later to figure out what wrong and what part of the project is bad.
    for now, i think i hate imovie again :)) piece of..
    let me know how your case ended.

  • Hi, I've been playing Smurf's village for a year now and just last week, i tried to get into the app but it keeps rejecting and goes back to the main page.  Is there any reason for this?  I've been updating the app everytime and now it's not letting me in

    Hi, I've been playing Smurf's village for a year now and just last week, i tried to get into the app but it keeps rejecting and goes back to the main page.  Is there any reason for this?  I've been updating the app everytime and now it's not letting me in.  Pls advise. Tq

    Reset the device, restart the device, try downloading any other app.
    All of these are basic steps that could have been found by a simple search of the forums as a resolution for the issue.

  • My touch typing won't work on phone page, but it works on messages or eMail?  is there a reason for this?

    When I try and type somethink on my Phone page of the iPhone it seems to have hund, yet I am able to send SMSSes, eMails, etc.?  Is there a reason for this?

    What's the URL of the page?
    In the mean time clear the cache and reload the page.

  • Hi, I m using an iPhone 4 and my yahoo push email was working just fine but for the last few days I am experiencing some problem that is the emails are not getting pushed , I have to manually fetch the mails. So what could be the reason for this....

    Hi, I m using an iPhone 4 and my yahoo push email was working just fine but for the last few days I am experiencing some problem that is the emails are not getting pushed , I have to manually fetch the mails. So what could be the reason for this.....I have set the email setting to "push" mode. Moreover I can't edit the mail server address ....current it's on Yahoo SMTP server

    Will it get rectified and restored...if so after how long. What could be the reason for such outage kindly share,  as I am facing real problem because of this...

  • I am using Gradens of time app on my ipad, it keeps crashing when I edit my garden, is there a reason for this? And how do I correct it?

    I am using the app for the aboved game but it keeps crashing when I am editing my garden and I have to restart the game, there a reason for this and what is the solution?

    As when there is a problem with a 3rd party app on your computer, contact the app developer and ask the developer why the app is crashing.

  • What could be the reason for this error file

    Hi,
    What could be reason for this error file, the content of the error file is :
    Compiling INSERT-PROCEDURE trigger on IOTDISPUTE_FILES data block...
    No compilation errors.
    Compiling UPDATE-PROCEDURE trigger on IOTDISPUTE_FILES data block...
    No compilation errors.
    Compiling DELETE-PROCEDURE trigger on IOTDISPUTE_FILES data block...
    No compilation errors.
    Compiling LOCK-PROCEDURE trigger on IOTDISPUTE_FILES data block...
    No compilation errors.
    Compiling INSERT-PROCEDURE trigger on IOTDISPUTEDETAILS data block...
    No compilation errors.
    Compiling UPDATE-PROCEDURE trigger on IOTDISPUTEDETAILS data block...
    No compilation errors.
    Compiling DELETE-PROCEDURE trigger on IOTDISPUTEDETAILS data block...
    No compilation errors.
    Compiling LOCK-PROCEDURE trigger on IOTDISPUTEDETAILS data block...
    No compilation errors.
    Created form file X:\IOT\IOT_SupportingSystem\Forms\IOTRAP.fmx
    I am getting this error while compiling a form with DML sources are Database Procedure.
    Thanks in advance.
    Rizly

    Hi,
    Sorry for the delayed response. These informations are generated in the FormName.err file. If its not the error, then why its not generating for other forms. As I mentioned earlier, this fom has DML sources by the Database Procedures, that could be the reason ?, this is my first project in Forms.
    The content of the IOTRAP.err file:
    Compiling DELETE-PROCEDURE trigger on IOTDISPUTEDETAILS data block...
    No compilation errors.
    Compiling LOCK-PROCEDURE trigger on IOTDISPUTEDETAILS data block...
    No compilation errors.
    Created form file X:\IOT\IOT_SupportingSystem\Forms\IOTRAP.fmx
    Thanks in advance.
    Rizly

  • I cannot log into facebook. I get the following message: 404 Error - Not Found The resource you have requested could not be found on the server. There are many possible reasons for this. Either the file does not exist, there is an error in your request,

    I am not able to go to the facebook site. www.facebook.com is not working. I get the following error message. 404 Error - Not Found
    The resource you have requested could not be found on the server. There are many possible reasons for this. Either the file does not exist, there is an error in your request, or the file is not accessible in the requested directory. Please verify that:
    * You have used the proper case; requests ARE case-sensitive!
    * You have entered the URL correctly. (i.e. proper directory/filename)
    * You used the FULL URL. (i.e. proper file type: .html, .gif , .jpg, etc.)
    * You use a tilde (~) before user directories. (i.e. www.furcen.org/~jurann/ )
    * The user/file still exists on this server.
    I also get redirected to "Busca Google" when typing www.facebook.com in the address bar.
    == URL of affected sites ==
    http://facebook.com; buscagoogle.com

    I have the same problem and it does not have to do with firefox. Do you have any idea how to fix it through?

  • My new (8/2012) iPod Touch: voice control suddenly activates on its own. Is there a reason for this and how do you get it to stop?

    For reasons unknown to me, my brand new ipod touch keeps activating Voice Control. I am not pressing the home button or touching any controls. I can be doing nothing with it and it just kicks on, sometimes interrupting what is already going on (like listening to an audio book in the Audible app. Is there a reason for this and how do I stop it?

    Press the Home Button 3 Times... then goto  >  Settings > General > Accessibility > Voice Over > Off
    Next... Try this...
    Close All Open Apps and Perform a Reset...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430

  • Why is it, after I downloaded the new version of steve jobs, I lost all my highlighted placements in the book and whenever I tried to highlight something, it lags tremendously. Is there a reason for this?

    Why is it, after I downloaded the new version of steve jobs, I lost all my highlighted placements in the book and whenever I tried to highlight something, it lags tremendously. Is there a reason for this?

    And all placement in which I highlighted in previous version of the book, it directs me to a completely different page and sentence in which I highlighted previously. And the frustrating is, I can't delete the false highlight.

  • ANY BODY TELL ME WHAT IS THE REASON FOR THIS ERROR

    hi... experts....
        Iam having one screen in my previous module pool program....and now as per my requirement i added on e new field...
    for that...
      1. i declared one variable in top include...
      2. cretaed one more new block with help of box in layout screen..
      3. added some text field and inputput out field...
      4. and in that block i also added one line with test like... following...
    " NOTE: PLEASE ENTER THE ..... VALUE..."   Like this.... just for to give direction...
    so these are  the steps i taken to add new field to my screen... but here i am geting error ... while entering the value in that field and press any push button.... including back in that screen... like....
      "INVAILD FIELD FORMAT (SCREEN ERROR)"
    .... ANY BODY TELL ME WHAT IS THE REASON FOR THIS ERROR... COMMONLY???
    THANK YOU,,,
    NAVEEN..

    hi naveen,
    there can be problem from ur layout side.
    Goto SE51. in Layout editor make sure that the type in screen and in TOP Include is same.
    and if you are using currency field than it can also give error to you.
    if still you any error .
    give me type of variable whcih you defined in TOP and also code.
    give reward if helpfull.

  • HT204003 if i open passbook on iphone 5, it always say cannot connect to itunes, any fix from apple tech support? and whats the reason for this problem? why do we have to figure it out and not even apple can give answer??

    if i open passbook on iphone 5, it always say cannot connect to itunes, any fix from apple tech support? and whats the reason for this problem? why do we have to figure it out and not even apple can give answer??

    actually i found out how to fix it
    1 sign out of apple account
    2 close down passbook app
    3 change year to 2013
    4 reopen passbook and sign in at the button with your apple ID
    5 change the time to auto update and it should work from now on.
    this worked for me let me know if it work for you:)

  • Play count question.   I have about 500 songs in my library that I know have played at least once...probably just once.  Although there is a "last played" date listed there is no number in the play count column.   Any reason for this?  thx

    I have about 500 songs in my library that have played one time.   Although a "last date played" date is noted, there is no number in the play count column.  This only happens some times.   Any reason for this, and can it be corrected?  thx

    Thanks, but the play count is not incrementing only on the very first play.  All subsequent plays are fine.  Meaning the play counts for these particular tracks are always one play short.  I double-checked some of the tracks in question and I have not shortened, or stopped them early.

  • The artwork for our podcast, "Japan Baseball Weekly," recently disappeared. The RSS feed info appears to be in order, any particular reason for this and what can be done to rectify the situation?

    The artwork for our podcast, "Japan Baseball Weekly," recently disappeared. The RSS feed info appears to be in order, any particular reason for this and what can be done to rectify the situation?

    Please always post the URLs of the Store page and the feed when you have a question. For reference, your feed is at
    http://www.japanesebaseball.com/services/jbw-podcasts.jsp
    and the Store page is at
    http://itunes.apple.com/gb/podcast/japan-baseball-weekly/id443149184
    Looking at the Store page, the image appears there perfectly well. On subscribing there is no image associated with the episodes because you haven't embedded an image in the files - please see this page for clarification:
    http://homepage.mac.com/rfwilmut/notes/coverart.html

  • HT1386 i can't sync some selected movies i bought in iTunes store. any reason for this please/

    I can't sync some selected movies i bought in iTunes store. Any reason for this and help please?

    I assume they are,  but I am not completely certain.  I purchased the songs from iTunes, so I would be surprised if they are in a format that is not playable by the Touch. 
    How do I check whether the format is playable?
    Thanks,

Maybe you are looking for