Java is a dynamic, secured and class based high level object oriented programming language developed by Oracle Corporation. On the other hand; C# is a .Net Framework object oriented programming language developed by Microsoft.
Java和C#都是通用的编程范式,或者基本上被称为命令式编程环境。而且这两种语言都能够提供一些高级结果作为输出。
In a broad view there are many differences between these two OOPs −
-
Java Runtime Environment旨在运行Java代码,而C#运行在CLR环境(公共语言运行时)。
-
Java和C#都是面向对象的编程语言。但是在特定的方式上,C#是一种功能和组件导向的强类型编码语言。这种语言提供了多重重载的特性,而这是Java所没有的。
-
这两者的Array特性也不相同。对于Java来说,Object是直接的专门化,而对于C#来说,Array是系统的专门化。
Use of C# -
-
Web app. Development
-
Windows application development.
-
Gaming application.
使用Java -
-
Web项目,大数据应用
-
Server-side programming
-
Embedded systems
-
Android应用程序
Java和C#语言的工作原理:
Java
In a software designing environment, it is important to have a runtime platform. The runtime platform provides the access to main memory and other important features of a system to run a code.
Java运行时环境(Java Runtime Environment)是一种基本的后端技术,它在Java构建代码和操作系统之间建立并创建通信渠道。简单来说,JRE是一个运行时工具,它提供了编写Java代码并运行以获得所需结果的所有资源。
There are two Java components −
-
JDK – Java开发工具包
-
JVM – Java Virtual Machine
A collection of software development tools to develop an application using Java. You can get many JDK version in matching with its Java version. Like, Java SE needs JDK Java SE.
JVM逐行运行Java代码。当Java应用程序运行时,开发人员配置设置。它还通过使用运行时检查正在运行的Java应用程序的内部存储。
C#
的中文翻译为:
C#
Basically, the .NET build codes compile into a Microsoft Intermediate Language aka MSIL by using Just in Time (JIT) compiler. Clearly, the output will be a machine code (written by a set of class libraries) and it will be produced by a machine processor.
The compiler and the CLR format the C# code to an executable code. Here we get an understanding complex machine environment in .NET. The executable codes can be saved as .exe and .dll files for Windows operating system.
A Java Code Algorithm:-
的中文翻译为:
一个Java代码算法:
-
第一步 - 在IDE中编写源代码。
-
Step 2 − Put It Into The Compiler.
-
步骤3 - 将其转换为字节码。
-
步骤 4 − JVM(Windows,MacOS,Linux)。
-
Step 5 − Converted Machine Code.
-
步骤 6 − 终止进程
A C# Code Algorithm:-
-
Step 1 − Start.
-
Step 2 − Select The Documents.
-
第三步 - 指令部分。
-
Step 4 − Select Interface.
-
第五步 - 选择课程。
-
第6步 - Main()方法声明。
-
步骤 7 - 没有头文件,导入 .dll 文件。
-
第8步 - 输入反射
Java代码的语法
public class Main {
public static void main (String[] args) {
System.out.println ("THE STATEMENT");
}
}
登录后复制
Syntax
using System;
namespace Tutorialspoint {
class Program{
static void Main(string[] args){
Console.WriteLine("Hello Student");
}
}
}
登录后复制
The class using system declares the system namespace. The namespace organises the code as a container. Every line of the written code that runs, must be stay inside a class in C# language.
Approach
-
Approach 1: A General Example of a Java Code.
-
方法二:C#代码的通用示例。
一个Java代码的一般示例
Example 1
public class TableofMultiplication {
public static void main(String[] args) {
int num = 18, j = 1;
while(j