Question:
Threading in dot net and java...? Difference?
deostroll
2006-12-27 23:08:24 UTC
Is there any technical difference between threading in java and threading in dot net? Then why do people say that threading in java is difficult. I haven't learnt java; I happen to learn threading in dot net. But if I am correct, this should be one and the same thing, right?
Four answers:
BoyScout
2006-12-27 23:30:02 UTC
Really there is not much difference.

Both are easy to achieve.

Especially if you compare it with C/C++

(which is different from one OS to another).



C# :



using System;

using System.Threading;

public class Test {

  static void SomeThreadJob() {

    // do something here

  }

  public static void Main(String[] args) {

    ThreadStart job = new ThreadStart( SomeThreadJob);

    Thread thread = new Thread(job);

    thread.Start();

  }

}



Java :



public class Test {

  static class SomeThreadJob implements Runnable {

    public void run() {

      // do something here

    }

  }

  public static void main(String[] args) {

    SomeThreadJob job = new SomeThreadJob();

    Thread thread = new Thread(job);

    thread.start();

  }

}



There are many different ways to do this, especially in Java,

but I wanted to show how much both languages can look alike.



Regards
Dr.Mr.Ed
2006-12-28 09:58:40 UTC
On the technical side, there's little real difference -- each implementation will use native threads behind the scenes. The major difference on the programming side is that with Java you usually create a class that implements Runnable, while in C# you pass a delegate to ThreadStart. This will lead to some coding differences, but most of the underlying work is the same.
Rex M
2006-12-27 23:12:09 UTC
The underlying concept of threading is going to be the same in every programming language because it is a general computing concept. The difference lies in how cumbersome it is to create and manage threads in different languages. In .NET it is relatively simple, and some people think that it is a bit more difficult in Java. It is the same to create, a little different to manage and do more sophisticated things with them. But it is really just a matter of preference and what language you are more familiar with.



But the answer to your question is no, there is no *technical* difference.
2016-03-29 01:57:06 UTC
I know there are many answers already here, but first I suggest you to learn C then C++ and next your choice. C and C++ gives you a strong hold in programmin. Windows almost uses C. Most of the games are developed in C because of its realiability. You can search in google for free C tutorials. I suggest you to start with learning consle then go for graphics.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...