J This is delicious cookie you must eat
















- Slides: 16
J# This is delicious cookie you must eat. : O~
Problem Domain • Designed to be Reliable, high-performance and secure Comfortable and familiar to Java-language developers Assist in the transition to. NET framework • Developed solely to write software for Windows, using the. NET framework
Historical Context Developed by Microsoft from 1998 to 2002. Named after Java / J++ # marking it as one of the. NET languages (C#, F#, …) Recycled from earlier attempt: Visual J++
Historical Context: J++ Windows-specific implementation of Java J++ programs only capable of running on Microsoft’s special interpreter, optimized for Windows. Sun Microsystems had originally licensed Java to Microsoft but sued over failure to fully implement Java specifications. As part of the settlement, Microsoft ceases distribution of the interpreter. J++ developers marooned.
Evolution of the Language Run-time libraries frozen at the JDK 1. 1. 4 level JDK compatibility largely irrelevant due to coverage elsewhere by the. NET framework. J# integrated into releases of Visual Studio Announcements in January 2007: J# upgrade for 64 -bit runtime support, compatibility with next version of Virtual Studio J# being retired from future versions of Virtual Studio, with support for the existing version ending 2015
New Concepts Same syntax as java Access to both java API and. NET Framework library (BCL - Base Class Library) Cross-language capabilities method written in one language can be overriden in another language
Familiar Java Syntax import System. *; public class Hello { public static void main(System. String[] args) { System. out. println("Hello. "); } }
Familiar Java Syntax cont. For Java To Compile - javac Hello. java To Run - java Hello For J# To Compile - jc Hello. java To Run - Hello
Access to both java API and. NET Framework library package Console. App; import java. io. *; public class Read. String { public static void main(String[] args) { String first. Name = null; String last. Name = null; System. Console. Write. Line("Enter your first name: "); Buffered. Reader br = new Buffered. Reader(new Input. Stream. Reader(System. in)); try { first. Name = br. read. Line(); } catch (IOException ioe) { System. out. println("IO error"); System. exit(1); } System. out. println("Enter your last name: "); last. Name = System. Console. Read. Line(); System. out. println("Hello " + first. Name + " " + last. Name); System. Console. Write. Line("Hello {0} {1}", first. Name, last. Name); } }
Cross-language capability //J# class import System. *; public class JLanguage { public void get. Message() { System. Console. Write. Li ne("J#"); } } //C# class using System; class CLanguage: JLanguage { public static void Main() { CLanguage c = new CLanguage(); JLanguage j = new JLanguage(); j. get. Message(); c. get. Message(); } public override void get. Message() { Console. Write. Line("C#"); } }
Google Search String J# C# java Google results. 4 M 5 M 64 M (not all are re the language, of course)
JAVA vs. J#/. NET
Advantages and Disadvantages
J# offers the following features: • Generates platform-neutral code • Support for class libraries of VJ++, JDK 1. 1. 4 • Brings cross-language capabilities into Java language • Simultaneously supports both JDK 1. 1. 4 and BCL (Base Class Library) of. NET Framework • Accesses platform-native resources • Generates XML documentation • Writes ASP. NET applications • Writes web services • Retains the majority of Java-like syntax and features
J#'s disadvantages: Programs can't run under the umbrella of JVM No support for the Java Native Interface or Remote Method Invocation No operator overloading Minimal support to convert binaries making J/Direct calls Automatic generation of proxy classes for web services Cannot call Web. Service methods using Enum types Cannot add reference to. exe files