Java初学
Java初学
-
类的命名为驼峰命名
-
源代码的文件名必须与公共类的名字相同,并用.java 作为扩展名
-
为了代码能够执行, 在类的源文件中必须包含一个
main方法,当然,也可以将用户自定义的方法添加到类中,并且在main方法中调用它们 -
main方法必须声明为public -
Java 中任何方法的代码都用"{"开始,用"}"结束。
-
在Java 中, 每个句子必须用分号结束。
-
注释方法
-
使用
//注释每一行System.out.println("We will not use 'Hello World'"); // is this too cute? -
长篇注释,使用
/* *//* 1 2 System.out.println("We will not use 'Hello World'"); */ System.out.println("We will not use 'Hello World'"); -
用于自动生成文档,格式为
/** *//** * This is the first sample program is Java * author zlbingo */ public class FirstSample { public static void main(String[] args) { System.out.println("We will noe use 'hello world'"); } }
-

浙公网安备 33010602011771号