简体   繁体   English

使用 import acm.program for java?

[英]Using import acm.program for java?

Is there any standard coding syntax in java? java中有没有标准的编码语法?

I was using System.acm.println while one of the stanford videos imports acm.program and use println for the same output.我正在使用System.acm.println而斯坦福视频之一导入 acm.program 并使用 println 进行相同的输出。

Yes Java is a statically typed language and has a very specific syntax.是的,Java 是一种静态类型语言,具有非常具体的语法。 Importing a package allows you to reference methods and classes within it without having to call it by it's full path.导入包允许您引用其中的方法和类,而无需通过其完整路径调用它。 For example, if you write import java.lang.Math;例如,如果你写import java.lang.Math; then when you want to call the method pow you can write Math.pow(param1, param2);那么当你想调用pow方法时你可以写Math.pow(param1, param2); instead of java.lang.Math.pow(param1, param2; . So, Stanford's class is importing the class acm.program to make it simpler and faster to code. This is standard coding practice. To get the acm library available in your project take a look at this: How to import a jar in Eclipse而不是java.lang.Math.pow(param1, param2; 。因此,Stanford 的类正在导入类acm.program以使其更简单和更快地编码。这是标准的编码实践。要在您的项目中使用 acm 库看看这个: How to import a jar in Eclipse

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM