I had a conversation with a friend and I guess I should post it here…its one of those few times when u get down real dirty to solve simple problems….

(6:21:03 PM) cyberdeen: quick in one min…..
(6:21:09 PM) cyberdeen: will this code compile?
(6:21:10 PM) cyberdeen: new Thread() {
public void start() {

(6:21:56 PM) adeniranope: no
(6:22:09 PM) adeniranope: public void run()
(6:22:16 PM) cyberdeen: will compile
(6:23:22 PM) cyberdeen: but u are wont do what it suppose to do
(6:23:47 PM) cyberdeen: but it will compile…to make do what its intended for use public void run()
(6:23:48 PM) adeniranope: as in what?
(6:24:09 PM) cyberdeen: the thread wont create a nw Thread wc is d essence of the code
(6:24:29 PM) cyberdeen: to make it create a nw process(sorry not thread) u must call run
(6:24:46 PM) adeniranope: dat’s true
(6:24:50 PM) cyberdeen: which is called by the start() method
(6:25:07 PM) cyberdeen: dese are the kinda question u see on javablackbelt
(6:25:10 PM) adeniranope: where did u get dat from?
(6:25:30 PM) cyberdeen: i wrote it myself
(6:26:05 PM) cyberdeen: so that network connection wont block
(6:26:55 PM) adeniranope: so u mean dat code won’t compile?
(6:27:10 PM) cyberdeen: it will compile…it will even run
(6:27:19 PM) cyberdeen: but networking will still be blocked
(6:27:38 PM) cyberdeen: i mean it will still block input until it is finished
(6:28:35 PM) adeniranope: so what’s the solution?
(6:29:01 PM) cyberdeen: new Thread() {
public void run() {

(6:29:21 PM) cyberdeen: public void start() ==== public void run()
(6:29:35 PM) adeniranope: i’m correct now
(6:29:41 PM) adeniranope: ?
(6:29:44 PM) cyberdeen: in a sense u are
(6:29:46 PM) adeniranope: abi
(6:29:55 PM) cyberdeen: but the question is will d code compile?
(6:30:01 PM) cyberdeen: wc u answered no
(6:30:22 PM) cyberdeen: but it will compile….the error is not syntax but semantics…she u get?
(6:30:47 PM) adeniranope: not at all
(6:31:02 PM) cyberdeen: i asked will d code compile?
(6:31:06 PM) cyberdeen: and u said no
(6:31:08 PM) cyberdeen: abi?
(6:31:15 PM) adeniranope: yes ooooooooo
(6:31:29 PM) adeniranope: en en why?
(6:31:43 PM) cyberdeen: but if u javac the code(compile) it will compile
(6:31:53 PM) cyberdeen: without errors
(6:32:00 PM) cyberdeen: u get? now abi
(6:32:07 PM) adeniranope: yes
(6:32:10 PM) cyberdeen: but still the code has errors
(6:32:33 PM) adeniranope: but if u run it what will happen?
(6:33:02 PM) cyberdeen: it wont create a new process
(6:33:16 PM) cyberdeen: which is what we want to code to do right?
(6:33:31 PM) adeniranope: and so ….
(6:33:37 PM) cyberdeen: so if a new process is not created….
(6:33:46 PM) cyberdeen: the code wont do wot its meant to do
(6:33:58 PM) cyberdeen: but it will COMPILE
(6:34:29 PM) adeniranope: what about the new Thread()
(6:34:51 PM) cyberdeen: a Thread is not a thread if there is no run method
(6:35:01 PM) adeniranope: ok
(6:35:16 PM) cyberdeen: u see the thing dt makes a thread a thread is run()..without run its just another class
(6:35:37 PM) adeniranope: so what about the .start()
(6:35:47 PM) cyberdeen: ok
(6:35:56 PM) cyberdeen: we need to call the run methos right?
(6:36:22 PM) adeniranope: dat means u’ve to replace the start method with run()
(6:36:29 PM) cyberdeen: dt is what the .start() will do for us
(6:36:41 PM) adeniranope: so dat when u call start() it will execute run
(6:36:50 PM) cyberdeen: when u call start…it will initialise the thread and then call run()
(6:37:07 PM) cyberdeen: u get it now abi…?
(6:37:23 PM) adeniranope: why can’t u call start() straight and have a run method inside it
(6:37:38 PM) cyberdeen: i dont get u?
(6:38:48 PM) adeniranope: what i’m saying is instead of having a start method inside it and calling it … why not override the run method of a thread and call start()
(6:39:31 PM) adeniranope: like this
(6:40:15 PM) cyberdeen: ?
(6:40:26 PM) adeniranope: new Thread{
public void run(){

(6:40:47 PM) cyberdeen: which is d correct version i sent to you
(6:41:20 PM) cyberdeen: new Thread() {
public void run() {

(6:41:23 PM) adeniranope: ok i never took time to check it

(6:41:44 PM) adeniranope: yes it will work
(6:41:54 PM) adeniranope: dat will work
(6:42:08 PM) cyberdeen: dis conversation shud be posted where java guys can see it…i will blog about it right away…



  1. Hello !

    I’m new on this forum so I introduce me…

    My name is Jason I’m 23 years old, I’m French.

    I like: holdem poker and baseball…

    Nice to meet you

  2. interlile said

    Man .. Excellent .. Wonderful .. I will bookmark your website and take the feeds alsoI’m glad to find numerous helpful info right here within the post, we’d like work out extra strategies on this regard, thank you for sharing. . . . . .

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: