Why we are going with Advanced languages(OOP) like C#,Java etc instead C.C++ (Procedure Oriented Languages) here is basic thing that as a trainee programmer has to understand.
Platform Dependency/In dependency.
Platform = Operating System + Micro Processor.
Platform Dependency :
Languages that are present in the industry before JAVA are platform dependent languages i.e., Applications that are developed by using these languages cannot be executed on other operating systems , when ever we compile the source code of a program written using these languages, will generate Machine code (or ) Executable code (or) Native code.
The machine code which which is generated for one operating system is not capable to execute on other operating systems.
In the above case machine code is generated for windows operating system so we can execute the code only on another windows machine but not on other operating systems.
In The above example the .exe file which is written using the C language in Windows OS is executed only in Windows OS but not in others .
NOTE: Any application which directly contacts with the OS is always dependent on OS.
Platform In-Dependency :
It is an approach of executing an application on multiple Operating Systems, this feature is available in advanced languages like C#, JAVA as well as any .NET languages also. In all these languages when ever we compile the source code, first it is converted into semi-finished/Intermediate code which can be carried and executed on any machine but to run the code on a machine first we need to install a software on the machine which converts the intermediate code into machine code according to the Operating System.
JAVA Language (Windows):
Source code –> Compile –> Byte code
Byte code –> JVM (Java Virtual Machine) –> Machine code
In above case of JAVA after compilation of source code it generates byte code (Semi-Finished) which can be carried and executed on any machine where the JVM is available which converts Byte code into Machine Code.
As .NET is a collection of languages we can write the source code by using any language of our choice but the code that is written by using any .NET language once after compilation generates MSIL code , which can be carried and executed in any machine, where the CLR is available which converts the MSIL code into machine code according to the Operating System.
NOTE : Both JVM & CLR are dependent on the operating system i.e., we need to install them separately for each Operating System.