1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package main;// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
- // then press Enter. You can now see whitespace characters in your code.
- public class SimpleFactoryTest
- {
- public static void main(String[] args)
- {
- try
- {
- SimpleFactory.createProduct("A").show();
- }
- catch (NullPointerException e)
- {
- System.out.println("没有A这款产品,无法生产~");
- }
- try
- {
- SimpleFactory.createProduct("B").show();
- }
- catch (NullPointerException e)
- {
- System.out.println("没有B这款产品,无法生产~");
- }
- try
- {
- SimpleFactory.createProduct("C").show();
- }
- catch (NullPointerException e)
- {
- System.out.println("没有C这款产品,无法生产~");
- }
- try
- {
- SimpleFactory.createProduct("D").show();
- }
- catch (NullPointerException e)
- {
- System.out.println("没有D这款产品,无法生产~");
- }
- }
- }
|