他们为什么用;结束Java / C ++中的语句 [英] Why they used ; to end statements in Java/C++
本文介绍了他们为什么用;结束Java / C ++中的语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
他们不应该使用。结束声明。他们可以使用 - >来调用方法。这只是一个疏忽吗?或者这里有更深入的内容?
Should not they have used . to end a statement. They could use -> to call a method. Was this just a oversight? Or there is some deeper going on here?
推荐答案
Java选择分号的语法类似于C和C ++。
Java picked the semicolon to have a syntax similar to C and C++.
C ++选择它的语法类似于C语言。
C++ picked it to have a syntax similar to C.
我猜C选择了分号因为B,ALGOL和Pascal已经使用过它,并且没有理由不使用已经接受的约定。
And I would guess that C picked the semicolon because B, ALGOL and Pascal already used it, and there was no reason not to use an already accepted convention.
这篇关于他们为什么用;结束Java / C ++中的语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文