java中的内置函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19502690/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Built in function in java
提问by user2903144
What is built in function in java? I found some question and it was like "... solve this without using built in function". So, what is it? I know java support methods,what's different between both of them?
java中的内置函数是什么?我发现了一些问题,就像“......在不使用内置函数的情况下解决这个问题”。那么,它是什么?我知道java支持方法,它们之间有什么不同?
回答by 75inchpianist
It means solve it using only methods that YOU have implemented. Do not use anything that came as a part of the JDK you installed.
这意味着仅使用您已实施的方法来解决它。不要使用您安装的 JDK 中附带的任何内容。
JDK = Java Development Kit
JDK = Java 开发工具包
It includes a rich library to assist with some of the more common tasks in java coding. It sounds like you are supposed to avoid using this library.
它包含一个丰富的库来协助处理一些 Java 编码中更常见的任务。听起来你应该避免使用这个库。
回答by Bucket
A built-in function is a method that is already implemented by the package you import. For example, if in your code you say,
内置函数是您导入的包已经实现的方法。例如,如果在你的代码中你说,
import java.util.Collections;
And later use Collections.sort(...)
, you are using a built-in function, since you did not write it- the Java developers did.
后来使用Collections.sort(...)
,您使用的是内置函数,因为它不是您编写的- Java 开发人员编写的。
If your requirements specify you must use a non-built-in function, you must write this sort()
(e.g.) algorithm yourself.
如果您的要求指定您必须使用非内置函数,则您必须sort()
自己编写此(例如)算法。
TL;DR- Built-in functions are already made. A non-built-in function is one you write yourself.
TL;DR- 内置函数已经制作完成。非内置函数是您自己编写的函数。
回答by Shamse Alam
Built in functionsin java are methods that are present in different API of JDK. For example cos(double a), exp(double a)
etc are built in function of java present in java.lang.Math
class.
java中的内置函数是存在于JDK不同API中的方法。例如,cos(double a), exp(double a)
etc 内置于java.lang.Math
类中存在的java 函数中。
Solve without using built in functionsmeans if you have to calculate X raised to the power of Y, you define your own logic to calculate the result. You don't use built in function Math.pow(X, Y)
, that returns the value of the first argument raised to the power of the second argument.
不使用内置函数求解意味着如果您必须计算 X 的 Y 次幂,您可以定义自己的逻辑来计算结果。您不使用内置 function Math.pow(X, Y)
,它返回第一个参数的值,该值是第二个参数的幂。
回答by Tarik
I would think that "built in function" within a language would rather mean intrinsic function. This is not the case of any function or class that are part of the JDK. These functions and classes are not part of the Java language per se. However, most probably, you have indeed been asked to avoid using any method or class belonging to the JDK although the expression is being used abusively.
我认为语言中的“内置功能”更像是内在功能。对于属于 JDK 的任何函数或类,情况并非如此。这些函数和类本身不是 Java 语言的一部分。然而,最有可能的是,您确实被要求避免使用属于 JDK 的任何方法或类,尽管该表达式被滥用。