Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

find error within this problem (thread)  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why I am getting wrong output?



output
 
Saloon Keeper
Posts: 1932
239
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at line #7. You are creating a new Thread object, but not specifying the target which contains the run() method.
 
Rancher
Posts: 3067
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

why I am getting wrong output?


What should the correct output be? Please post an example of the correct output.
 
Master Rancher
Posts: 2651
91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming OP had this in mind:

output can be:

Runnable: two started to run.
Runnable: three started to run.
Runnable: one started to run.
two : 0
three : 0
two : 1
one : 0
two : 2
three : 1
three : 2
three : 3
three : 4
three : 5
two : 3
one : 1
two : 4
two : 5
two : Complited
three : Complited
one : 2
one : 3
one : 4
one : 5
 
Norm Radder
Rancher
Posts: 3067
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deleted
 
Sheriff
Posts: 4866
136
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can't put the genie back in the bottle, but let's not post complete solutions in the future. Illustrations are fine.
 
Norm Radder
Rancher
Posts: 3067
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree 100%. My post was to test what this forum's policy was.
 
Marshal
Posts: 59131
180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should be able to read the policy here.
 
Norm Radder
Rancher
Posts: 3067
33
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this it:

We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.

 
Piet Souris
Master Rancher
Posts: 2651
91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, different people have different styles, and where one uses 400+K questions, others might give a code example.

In this specific case, I should not have given this code, I admit, but I was triggered by your obligate question.

But I have one request: can you reserve your hostile comments towards me exclusively for DreaimInCode, please?
 
Knute Snortum
Sheriff
Posts: 4866
136
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was my tone hostile? If so, I apologize. I wish there were an emoji for normal tone of voice.
 
Piet Souris
Master Rancher
Posts: 2651
91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No Knute, it had nothing to do with you.
 
Greenhorn
Posts: 11
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a point of reference, in Java class names should start with a Capital Letter.
 
bacon. tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!