main()中的C,C ++,Java和C# [英] main() in C, C++, Java, C#

查看:104
本文介绍了main()中的C,C ++,Java和C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时的main()(或主())在C,C ++,Java或C#,用户定义的函数或内置函数?

Is main() (or Main()) in C, C++, Java or C#, a user-defined function or a built-in function?

推荐答案

这是一个用户定义的函数,是必要的程序执行。当你在编译语言运行你的程序中,功能是指在执行什么。例如,在Java中,如果你有可以执行的类中的一类,然后签名公共静态无效的主要(字符串参数... args)的功能,作为JVM将执行的内容方法。

It's a user-defined function that is necessary for a program to execute. When you go to run your program in the compiled language, the main function is what is executed. For instance, in Java, if you have a function of the signature public static void main(String ... args) in a class then that class can be executed, as the JVM will execute the contents of that main method.

例在Java中:

public class Test {
  public static void main(String ... args) { 
    System.out.println("Hello World");
  }
}

...

javac Test.java

...

java Test

在Hello World的结果被​​打印到控制台上。

Results in "Hello World" being printed to the console.

这篇关于main()中的C,C ++,Java和C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆