如何返回布尔值 [英] How to return boolean values
问题描述
我是java的新手,刚刚开始学习它的基本概念。我发现了一个问题:写一个函数检查的原型,它接收double和float类型并返回一个布尔值。有谁可以帮我这个?
我尝试过:
到目前为止我已经完成了这个:class bool {public static boolean(double a,float b){
现在该怎么办?
你做的几乎已经完成了。
boolean 考试( double d, float f)
如你所知,Java
不允许任何函数,它只允许方法。所以问题看起来有点奇怪。
您需要编写该方法的实现。但由于你没有解释管理方法的规则,我们无法猜测需要什么。引用:现在该怎么办?
你还需要了解一个类和一个方法之间的区别(功能)。如果您没有任何学习指南,请转到 Java™教程 [ ^ ]。
I am new to java and have just started to learn its basic concepts. I found a question which says that : Write the prototype of a function exam which receives a double and a float type and returns a boolean value. Can anyone please help me with this?
What I have tried:
I have done this so far: class bool { public static boolean(double a, float b) {
What to do now??
What have you done is almost complete.
boolean exam(double d, float f)
As you noted,Java
allows no functions, it just allows methods. So the question looks a bit strange.
Quote:What to do now??
You need to write the implementation of that method. But since you have not explained the rules governing the method we have no way of guessing what is required.
You also need to learn the difference between a class and a method (function). If you do not have any study guides then go to The Java™ Tutorials[^].
这篇关于如何返回布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!