English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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?

2006-12-27 18:08:24 · 4 answers · asked by deostroll 3 in Computers & Internet Programming & Design

4 answers

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

2006-12-27 18:30:02 · answer #1 · answered by BoyScout 2 · 2 1

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.

2006-12-28 04:58:40 · answer #2 · answered by Dr.Mr.Ed 5 · 2 0

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.

2006-12-27 18:12:09 · answer #3 · answered by Rex M 6 · 0 0

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.

2016-03-28 21:57:06 · answer #4 · answered by Anonymous · 0 0

fedest.com, questions and answers