zoukankan      html  css  js  c++  java
  • 英语笔记2

    JAVA

    Naming(Variable Names变量命名规则)

    1.Variable names are case-sensitive. A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "_". The convention, however, is to always begin your variable names with a letter, not "$" or "_". Additionally, the dollar sign character, by convention, is never used at all. You may find some situations where auto-generated names will contain the dollar sign, but your variable names should always avoid using it. A similar convention exists for the underscore character; while it's technically legal to begin your variable's name with "_", this practice is discouraged. White space is not permitted.

    变量名区分大小写,不建议使用_$。

    2.Subsequent characters may be letters, digits, dollar signs, or underscore characters. Conventions (and common sense) apply to this rule as well. When choosing a name for your variables, use full words instead of cryptic abbreviations. Doing so will make your code easier to read and understand. In many cases it will also make your code self-documenting; fields named cadencespeed, and gear, for example, are much more intuitive than abbreviated versions, such as sc, and g. Also keep in mind that the name you choose must not be a keyword or reserved word.

    建议使用单词全品而不是缩写

    3.If the name you choose consists of only one word, spell that word in all lowercase letters. If it consists of more than one word, capitalize the first letter of each subsequent word. The names gearRatio and currentGear are prime examples of this convention. If your variable stores a constant value, such as static final int NUM_GEARS = 6, the convention changes slightly, capitalizing every letter and separating subsequent words with the underscore character. By convention, the underscore character is never used elsewhere.

    多个单词的命名,第一个小写其他首字母大写。常量值的命令略有不同,每个单词都要大写而且单词之间通过“_”下划线分割。

    Naming a Method(方法命名规则)

    1.By convention, method names should be a verb in lowercase or a multi-word name that begins with a verb in lowercase.

      按照惯例,方法名应该是个动词小写。多个单词第一个也应该是动词小写

    2.In multi-word names, the first letter of each of the second and following words should be capitalized

       多个单词命名,第二个和后面的每个单词的第一个字母都应该大写

    java - the Java application launcher(启动java应用)

    The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class's main method.

    通过java工具启动java应用,它是先开始运行java运行环境,然后加载指定的类和调用该类的main方法

    The method must be declared public and static, it must not return any value, and it must accept a String array as a parameter. The method declaration must look like the following:

        public static void main(String args[])
    

    By default, the first non-option argument is the name of the class to be invoked. A fully-qualified class name should be used. If the -jar option is specified, the first non-option argument is the name of a JAR archive containing class and resource files for the application, with the startup class indicated by the Main-Class manifest header.

    The Java runtime searches for the startup class, and other classes used, in three sets of locations: the bootstrap class path, the installed extensions, and the user class path.

    Non-option arguments after the class name or JAR file name are passed to the main function.

    Primitive Data Types(基本(原始)数据类型)

    In addition to the eight primitive data types listed above, the Java programming language also provides special support for character strings via the java.lang.String class. Enclosing your character string within double quotes will automatically create a new String object; for example, String s = "this is a string";String objects are immutable, which means that once created, their values cannot be changed. The String class is not technically a primitive data type, but considering the special support given to it by the language, you'll probably tend to think of it as such. You'll learn more about the String class in Simple Data Objects

    Cookies

    Web applications are typically a series of Hypertext Transfer Protocol (HTTP) requests and responses. As HTTP is a stateless protocol, information is not automatically saved between HTTP requests. Web applications use cookies to store state information on the client. Cookies can be used to store information about the user, the user's shopping cart, and so on.

    Types of Cookies

    The two types of cookies follow:

    • Session cookies – Session cookies are stored in memory and are accessible as long as the user is using the web application. Session cookies are lost when the user exits the web application. Such cookies are identified by a session ID and are most commonly used to store details of a shopping cart.
    • Permanent cookies – Permanent cookies are used to store long-term information such as user preferences and user identification information. Permanent cookies are stored in persistent storage and are not lost when the user exits the application. Permanent cookies are lost when they expire.
  • 相关阅读:
    UIScrollerView遇到UINavigationController
    iOS 自动化打包
    最最基本的SQL常用命令
    导入样式表与外部样式表的区别
    jdk、jre、JVM的简单区别与联系
    JDBC驱动的四种类型
    将映射中的值进行排序并输出键
    Java优先级队列
    Java线程池
    Callable--创建有返回值的线程
  • 原文地址:https://www.cnblogs.com/jinliang374003909/p/10724286.html
Copyright © 2011-2022 走看看