【发布时间】:2015-03-23 08:04:51
【问题描述】:
我的意思的一个例子是:
Color maroon = #800000;
Color red = #ff0000;
if (red <resembles> maroon) //which would return true because they're both red colors.{
//...
} else {
System.out.println("The colors did not resemble.");
}
这可能吗?如果可以,我该怎么做?
【问题讨论】:
-
是的,如果你写一个实现这种逻辑的方法。
-
发红需要多少 才能通过测试?是否允许混合其他颜色?
-
那么你将如何指定normality?你现在说的太主观了。例如,您的“栗色”[原文如此] 在黑色背景下看起来会比在绿色背景下更红。
-
Color maroon = #800000;之类的语句不是有效的 Java。 -
@Jesper 我知道,这只是一个十六进制的例子,我没怎么用过颜色,但以后会用。
标签: java if-statement colors compare