Java foo 是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20208787/
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
What does foo mean?
提问by Dale22599
I've seen a lot of people using "foo" as method names or class names in java on Stackoverflow and other things. What's foo? Is it just a generic name for any method, class, etc. or does it actually mean anything? And why foo? Is it only for java or do people use it for other languages too?
我看到很多人在 Stackoverflow 和其他东西上使用“foo”作为 Java 中的方法名或类名。什么是福?它只是任何方法、类等的通用名称还是它实际上意味着什么?为什么是 foo?它仅用于 Java 还是人们也将其用于其他语言?
采纳答案by Daniel Gratzer
It's traditionally used for just a random name. Some other common ones are:
它传统上仅用于随机名称。其他一些常见的有:
- Foo
- Bar
- Quux
- Baz
- 富
- 酒吧
- 库克斯
- 巴兹
The supposed origin of foo and bar is that "FUBAR" was WWII slang for F***ed Up Beyond All Recognition. FUBAR => FOOBAR => Foo and Bar.
foo 和 bar 的假设起源是“FUBAR”是二战时的俚语,意为“F *** ed Up Beyond All Recognition”。FUBAR => FOOBAR => Foo 和 Bar。
There isn't really a compelling reason to choose it besides the fact that no language reserves the word foo
and that it's easy enough to type/read.
除了没有语言保留这个词foo
并且它很容易打字/阅读之外,没有真正令人信服的理由选择它。
回答by ps2goat
foo
is a term used to represent something without you getting too attached to the meaning. I could say object a
in its place or literally anything else.
foo
是一个术语,用于表示某物,而您不会太执着于其含义。我可以object a
代替它说,也可以说其他任何东西。
see examples 1 or 4 here: http://www.urbandictionary.com/define.php?term=foo
在此处查看示例 1 或 4:http: //www.urbandictionary.com/define.php?term=foo
回答by Beta
It's a generic name for a thing, using in computer science in general. Etymologically, "foo" is the first syllable of "FUBAR", which is an acronym for "**ed Up Beyond All Recognition/Recovery".
它是事物的通用名称,一般用于计算机科学。在词源上,“foo”是“FUBAR”的第一个音节,它是“ **ed Up Beyond All Recognition/Recovery”的首字母缩写。
回答by Sudhakar Tillapudi
it is just an identifier
which you can assign to methods
or classes
.
它只是identifier
您可以分配给methods
or 的an classes
。