• Welcome to Valhalla Legends Archive.
 

Java vs J#

Started by MoNksBaNe_Agahnim, March 15, 2004, 03:56 PM

Previous topic - Next topic

MoNksBaNe_Agahnim

In my programming class we had a mix class. Programming 1 (C++) and Programming 2 (Java). I noticed while talking to my teacher and browsing in .Net that there is J#, which is supposed to be Microsofts version of Java, he said something like its Visual Basic meets Java.

My question being, out of pure curiosity since one day I may learn Java, has anyone spent time with J# and if so or have some knowledge of it, what are the difference between Java and J#.

Thanks

-MBane_Agahnim

Tuberload

Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

Dark-Feanor

#2
Java and J# are basically the same thing, except that Microsoft made J# really ghetto. It is not portable and only works on Microsoft operating systems.
- Feanor[xL]
clan exile
Firebot
iago: "caps lock is like cruise control for cool"

iago

Quote from: DaRk-FeAnOr on March 16, 2004, 12:26 AM
Java and J# are basically the same thing, except that Microsoft made J# really ghetto. It is not portable and only works on Microsoft operating systems.

Thus defeating the main advantage of Java....
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Dark-Feanor

#4
That is why J# is a ghetto form of Java.  ;)
- Feanor[xL]
clan exile
Firebot
iago: "caps lock is like cruise control for cool"

MyndFyre

#5
Quote from: DaRk-FeAnOr on March 16, 2004, 12:26 AM
Java and J# are basically the same thing, except that Microsoft made J# really ghetto. It is not portable and only works on Microsoft operating systems.

If you choose to use J# with console applications (what you will mostly be doing in a CS class), then you can use it and it will be completely portable to the JDK.

A few things to note:

In the Microsoft implementation, you can only use up to the JDK version 1.2.1, because Microsoft settled a suit with Sun and they aren't allowed to implement beyond that version of the class library.

Also, the Microsoft standard is a little bit different from the Java standard for nomenclature.  Because the .NET platform allows you to use Properties (methods on a class that look like public fields), they decided that in order to do so, they would do something special:

JDK-standard Nomenclature:

public class MyClass
{
   // code ...
   public String getName() { return m_name; }
   public void setName(String value) { m_name = value; }
}


Microsoft Nomenclature, enabling properties:

public class MyClass
{
   // code...
   /** @property */
   public String get_Name() { return m_name; }
   /** @property */
   public void set_Name(String value) { m_name = value; }
}


Now, with properties, what we can do with C# or VB is something along the lines of:


[C#]
MyClass mc = new MyClass();
//...
string theName = mc.Name;
[VB]
Dim mc As New MyClass()
' ...
Dim theName As String
theName = mc.Name


The nice thing about properties is that they provide the convenience of fields with the power of encapsulation; you can prevent illegal values from being passed in as a parameter.

Events are treated in much the same way; in J# version 1, you can't declare your own typed event-handlers (delegates), but you can consume them.  You use syntax similar to add_Handler(delegate-type-instance); and remove_Handler(delegate-type-instance);.  Delegates are essentially safe function pointers, because they are checked at compile-time to ensure that the function to which they point matches the appropriate parameter type list.

The JavaDoc-style @command commands were added to J++ and then to J# when Microsoft made J++, enabling support for various proprietary extensions.  JDK compilers ignore them, so having the @property attribute will be ignored by a JDK compiler.

Cheers.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.