Learn about the differences between C# and Java.

C# and Java.




 I have decided to evaluate the comparisons and contradictions of two high-level programming languages, this will provide specific differences, similarities behind the language syntax including comparison tables with side-by-side keyword analysis, code snippets with detailed explanations, this post with the new post will provides significant assistance as a developer.


 This will be my introductory post on this topic


 Getting Started with C#
 C# was created in 2002 by Microsoft as a programming which was object-oriented, provides familiarity to programmers coming from C or C++ background and also which can create interoperable, robust and scalable applications targeting both desktop and mobile platforms. C# is built using the Microsoft .NET Framework which is a software framework designed to run on Windows operating system. The Microsoft .NET Framework contains a large set of utilities that manage the execution of programs written specifically for the framework.

 Using the Microsoft .NET Framework, the code of a program is compiled into CIL-Common Intermediate Language (formerly called MSIL) and stored in a file called assembly. This assembly is then compiled by the Common Language Runtime (CLR) to the native code to the operating system. This is done at run-time by the Just-In-Time (JIT) compiler present in the CLR. The CLR converts the CIL code to the machine language code which is a .exe file also known as portable EXE as it contains machine-independent instructions. The portable EXE works on any operating system that supports the .NET platform.

Compiling and executing a program using the command line interface
 Microsoft .NET framework provides the following CSC command to compile a program into a CIL

 To compile a C# file
 csc ClashApp.cs
 To execute a program
 ClashApp.exe


 Getting Started with java

 Java was created in 1991 by  Sun Microsystems, with the idea of designing a programming language for consumer devices, such as the television.
 The language was required to be small, fast, efficient, and platform independent which could be used to develop application for different platforms. Earlier languages, C and C++, were not preferred as they used compilers that were dependent on a particular CPU. Development of compilers was also expensive and time consuming. Hence, efforts were taken to produce a portable and a platform independent language that would run on any machine and there java was born.
 The creation of the java programming language also provides an object-oriented language using the java platform which is a software-only platform that runs on top of other hardware-based platforms. It contains the Java Runtime Environment (JRE) with components namely, Java Virtual Machine (JVM) and Java class library. The Java class library is also referred to as Java Application Programming Interface (Java API).  In Java, the compiled code is not translated into an executable code. It is instead compiled and converted into a bytecode which is an intermediate form closer to machine representation. In other words, the Java bytecode is an optimized set of instructions executed by the Java runtime environment. The JVM is an execution engine which creates a platform independent execution environment for executing Java compiled code. There are different implementations of JVM available for different platforms, such as Windows, Unix, and Solaris. Thus, the execution of same bytecode by different implementations of JVM on various platform results in code portability and platform independence.

 Development Tools – The Java platform provides different tools that form the foundation of JDK. The development tools include tools used for compiling, running, debugging, and documenting a Java application
 Some of the development tools provided by the JDK are:

  •  javac - This is the compiler.
  • java - This is the launcher.
  • Javadoc - This is the documentation tool.
 The example below demonstrates compiling and running a java program using the development tools described above.
 The ClashApp.java file is known as source code file. It is compiled by invoking tool named javac.exe, which compiles the source code into a .class fie. The .class file contains the bytecode that is interpreted and converted into machine code before execution. To run the program, the Java interpreter, java.exe is required which will interpret and run the program.

 To compile a java file
 javac ClashApp.java
 To run the program
java ClashApp

Comments

Popular posts from this blog

Firebase Test Lab for Android Robo Test

C# and Java Language History and Evolution

Differences between C# and Java cont'd -- Variables and operators