类名是否允许为小写 [英] Are class names allowed to be lower case

查看:203
本文介绍了类名是否允许为小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在声明以小写字母开头的类名时成功运行了我的程序。我不明白为什么要求以第一个大写字母开头。

I ran my program successfully when declaring a class name starting with a lower case letter. I don't understood why it is asked to start with first capital letter.

推荐答案

你可以用小写字母声明它,但是惯例是以大写字母开头。创建这些约定是为了让其他人更容易阅读和理解您的代码。

You can declare it with lower case, but the convention is to start with a capital letter. The conventions were created to make it easier on others to read and understand your code.

与此定义不同:

class someClass 
{
    otherClass b = null;
}

坚持使用约定甚至可以帮助Stack Overflow以一种方式为代码着色它更具可读性:

Sticking with the conventions even helps Stack Overflow color your code in a way that makes it more readable :

class SomeClass
{
    OtherClass b = null;
}

这篇关于类名是否允许为小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆