import java.text.DateFormat;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import org.junit.Test;
public class SimpleFactoryDemo {
@Test
protected void method1() {
//介绍几个简单工厂案例。
DateFormat dateFormat=DateFormat.getInstance();
Date date=new Date();
System.out.println(dateFormat.format(date)+"n");
//这些都是一个工厂方法。你可以点击源码去看。
System.out.println(LocalDate.now());
System.out.println(LocalDateTime.now().hashCode());
System.out.println(LocalDateTime.now().hashCode());
System.out.println(LocalDateTime.now());
System.out.println(LocalDateTime.now());
System.out.println(LocalDateTime.now());
NumberFormat numberFormat=NumberFormat.getInstance();
NumberFormat PercentFormat=NumberFormat.getPercentInstance();
double num=2.3;
System.out.println(numberFormat.format(num)+"n"+PercentFormat.format(num));
}
}