Hack Forums
[Java] Java or .Net - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Java] Java or .Net (/showthread.php?tid=2316854)

Pages: Pages 1 2


Java or .Net - Marcos MC - Mar 18, 2012

Hello everybody, i have a question, i am going to learn Java or .Net programming but i can't chose who is the best, can someone help me?. Thanks

P.S: It is possible to make shell booters in java?


* - Jire - Mar 18, 2012

I'd choose Java. Once you learn Java it'll take around 2 days to learn C#.

And yes it's possible to make shell booters in Java. :)


* - MatthewHodnick - Mar 22, 2012

Java, I love C# but think about it. C# is an interpreted and Windows only language. Well besides Mono. And Java is one of the most portable languages - write once, run everywhere. Where C# isn't like that. I'd say just learn Java, because it's a lot more useful to know. In my opinion anyway.


* - AlboBoy94 - Mar 22, 2012

Java. once you do learn java C#.NET will come pretty easy too you.


* - LiamLC - Mar 22, 2012

java for sure, it's a great language that is easy to learn but also one of the most powerful languages


* - Bigandrewgold - Mar 22, 2012

you asked this in the java section, what answers do you think this will get?


* - Fizzix - Mar 22, 2012

This question is idiotic. You are asking people to compare a framework to a language; you should be comparing a JVM 'based' language vs a .NET 'based' language.

Such as Scala vs. C#, Clojure vs. F#, or the more common Java vs. C#. Or the more interesting (IMO) Java vs J#, or Scala (on JVM) vs Scala (on .NET framework).


* - Colby_ - Mar 22, 2012

(Mar 22, 2012 08:40 PM)Fizzix Wrote:  This question is idiotic. You are asking people to compare a framework to a language; you should be comparing a JVM 'based' language vs a .NET 'based' language.

Such as Scala vs. C#, Clojure vs. F#, or the more common Java vs. C#. Or the more interesting (IMO) Java vs J#, or Scala (on JVM) vs Scala (on .NET framework).
Nobody uses your shitty scala, gtfo


* - Fizzix - Mar 22, 2012

(Mar 22, 2012 09:23 PM)Colby_ Wrote:  Nobody uses your shitty scala, gtfo

Right, because LinkedIn, Twitter, Novell, The Guardian, Xerox, FourSquare, Sony, and several other large companies don't use it... Oh wait, they do.

Also, I'd love to know how it is shitty, and what is better than it (and why).


* - badbrains - Mar 23, 2012

(Mar 18, 2012 03:48 PM)Marcos MC Wrote:  Hello everybody, i have a question, i am going to learn Java or .Net programming but i can't chose who is the best, can someone help me?. Thanks

P.S: It is possible to make shell booters in java?

Java. It's more flexible. I've started learning it just recently, it's much more fun than .NET.

Good luck with your learning.


* - novalyze - Mar 23, 2012

(Mar 23, 2012 02:23 AM)Count Bossula Wrote:  Java. It's more flexible. I've started learning it just recently, it's much more fun than .NET.

Good luck with your learning.

well .net is arguably more fun because you have access to the entire winapi


* - badbrains - Mar 23, 2012

(Mar 23, 2012 02:54 AM)novalyze Wrote:  well .net is arguably more fun because you have access to the entire winapi

True, everyone has different opinions though. 🙂


* - XciZioN - Mar 23, 2012

I choose Java because it is a lot more portable. You can write something once, and run it on any OS. .NET is limited to windows.

Java also helps (if you use it properly) you learn C++. Syntatically, Java and C++ are very similar. People have a misconception about Java when they say you cannot access the WinAPI with Java. Java has something known as the Java Native Interface, or JNI. It allows you to execute raw C\C++\Assembly code.

A quick example:

JNIFoo.java
Code
public class JNIFoo {    
    public native String nativeFoo();    

    static {
  System.loadLibrary("foo");
    }  

    public void print () {
    String str = nativeFoo();
    System.out.println(str);
    }

    public static void main(String[] args) {
    (new JNIFoo()).print();
    return;
    }
}

foo.c
Code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <jni.h>
#include "JNIFoo.h"

JNIEXPORT jstring JNICALL Java_JNIFoo_nativeFoo (JNIEnv \*env, jobject obj)
{
  int i;
  int ds_ret;

  char\* newstring;

  jstring ret = 0;

  newstring = (char\*)malloc(30);

  if(newstring == NULL)
  {  
  return ret;
  }

  memset(newstring, 0, 30);  

  newstring = "foo: Test program of JNI.\\n";

  ret = (\*env)->NewStringUTF(env, newstring);

  free(newstring);

  return ret;
}



* - Whired - Mar 23, 2012

(Mar 23, 2012 02:54 AM)novalyze Wrote:  well .net is arguably more fun because you have access to the entire winapi

This. Makes you feel powerful.

(Mar 23, 2012 08:59 AM)XciZioN Wrote:  People have a misconception about Java when they say you cannot access the WinAPI with Java.

No one (here) has explicitly said that o_O. Nova meant direct access. Aside from a [DLLImport], it's practically seamless. JNI is clunky as hell.


* - novalyze - Mar 23, 2012

(Mar 23, 2012 08:59 AM)XciZioN Wrote:  I choose Java because it is a lot more portable. You can write something once, and run it on any OS. .NET is limited to windows.

Java also helps (if you use it properly) you learn C++. Syntatically, Java and C++ are very similar. People have a misconception about Java when they say you cannot access the WinAPI with Java. Java has something known as the Java Native Interface, or JNI. It allows you to execute raw C\C++\Assembly code.

A quick example:

JNIFoo.java
Code
public class JNIFoo {    
    public native String nativeFoo();    

    static {
  System.loadLibrary("foo");
    }  

    public void print () {
    String str = nativeFoo();
    System.out.println(str);
    }

    public static void main(String[] args) {
    (new JNIFoo()).print();
    return;
    }
}

foo.c
Code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <jni.h>
#include "JNIFoo.h"

JNIEXPORT jstring JNICALL Java_JNIFoo_nativeFoo (JNIEnv \*env, jobject obj)
{
  int i;
  int ds_ret;

  char\* newstring;

  jstring ret = 0;

  newstring = (char\*)malloc(30);

  if(newstring == NULL)
  {  
  return ret;
  }

  memset(newstring, 0, 30);  

  newstring = "foo: Test program of JNI.\\n";

  ret = (\*env)->NewStringUTF(env, newstring);

  free(newstring);

  return ret;
}

except that requires you to do a lot of extra work, and i mean A LOT. that stuff gets so time consuming you end up wasting most of the time working on natives while you should be working on the original application.