// 代码缩进使用4个空格。注释内容与注释符号留一个空格。
public class HelloWorld {// 左大括号前不换行,且与前一个字符留一个空格。
public static void main(String[] args) {
int a = 1;// 二目,三目运算符左右两边都要加空格,包括= == + - && < > * /等等
int b = a + 2;
if (b > 2) {// if/while/switch/for/do等保留字与符号之间留空格
System.out.println(b);
}// 右括号换行
System.out.println("hello world");
System.out.println("a");
System.out.println("b");
pc(1, 2, 3);// 方法中的多个参数在定义和传入时都要在留一个空格。
}
public static void pc(int x, int y,int z) {
System.out.println("c");
}
}
敲一手好看的java代码。
猜你喜欢
转载自blog.csdn.net/hpccph15/article/details/85038806
今日推荐
周排行