2

day02

  • 编写Hello World程序
  • java编译风格

编写 Hello World 文件


public class HelloWorld{
  public static void main(String []args){
  System.out.println("Hello World")
  }
}

java代码编写风格

1.次行风格

public class Test
{
  public static void main(String []args)
  {
   System.out.println("Hi");
  }
}

2.行尾风格(本人在用 推荐)

public class Test2{
  public static void main(String [] args){
   System.out.println("Hello World");
  }
}

1.次行风格在代码量少 的时候方便阅读
2.行尾风格可以减少一些细微的错误,且更节省空间
注:尽量不要两种风格 混搭!


嘻嘻硕
27 声望12 粉丝

想当一只天然呆的鸭qwq