一.流程分支 If/else :基于boolean值的双分支 Switch:基于数字(整数.char.byte.枚举).字符串 类型的多分支 Int month =5; Switch 二.方法method 1.方法就是一个子程序 Java中方法的命名规范是驼峰命名法. int add( int a, int b ){ int result = a + b; return result; } float add( float a, float b){ float result = a + b; r
其实是为了填之前的一个坑 在一个多线程的案例中出现了阻塞的情况. https://www.cnblogs.com/hetutu-5238/p/10477875.html 其中的第二个问题,即多个线程循环顺序打印1,2,3,4 public class Demo2 { public static volatile int index = 0; public static void main(String[] args) { ThreadTest t1 = new ThreadTest("线程
public class SomeTrying{ public static void main(String[] args){ new Son(); new Son().Father(); } } class Father{ //父类Father的无参构造函数 public Father (){ System.out.println("Father Construtor"); } //父类Father的带参构造函数 ,构造函数不是成员函数,它只代表类本身,所以一个类可以有多个构造函数