我将文件另存为 1.java , 2.obj 和 3.txt 。 然后我使用Visual Studio命令提示符来编译文件: csc 1.java csc 2.obj csc 3.txt
I save the file as 1.java, 2.obj and 3.txt. I then use the Visual Studio Command Prompt to compile the file: csc 1.java csc 2.obj csc 3.txt
令人惊讶的是,它将所有3个文件编译为可执行文件并成功执行。
Surprisingly, it compiles all the 3 files into an executable and executes it successfully.
有人可以给我对此行为的解释吗?
Could anyone give me an explanation on this behavior?
推荐答案开始的C#对象:从概念到代码-Jacquie Ba rker,格兰特·帕尔默(Grant Palmer)
建议的约定是使用扩展名.cs结束源代码文件名,但是没有必要这样做;可以想象,源文件可以命名为Person.boo,例如
The recommended convention is to end source code file names with the extension .cs, but there is no requirement to do so; a source file could conceivably be named Person.boo, for example
也可以从同一本书。
类似地,C#源文件的名称不必与内部定义的类或接口的名称匹配。该文件。例如,可以将定义Professor类的代码放在名为 Blah.cs的文件中,但是将源文件名匹配为的源文件名与该类的名称或在文件内声明的接口。
Similarly, the name of a C# source file doesn't have to match the name of the class or interface defined within that file. For example, the code defining the Professor class could be placed in a file named Blah.cs, but it's considered good practice for a source file name to match the name of the class or interface declared within the file.
更多推荐
C#编译器编译.txt .obj .java文件
发布评论