Thread currentThread = Thread.currentThread();
String threadName = currentThread.getName();
System.out.println("當前線程的名稱為:" + threadName);
Thread currentThread = Thread.currentThread();
currentThread.setName("MyThread");
System.out.println("當前線程的名稱為:" + currentThread.getName());
Class<?> clazz = String.class;
String className = clazz.getName();
System.out.println("String類的全限定名稱為:" + className);
Object obj = new String("Hello");
String className = obj.getClass().getName();
System.out.println("對象的類名為:" + className);
Method method = String.class.getMethod("toUpperCase");
String methodName = method.getName();
System.out.println("方法的名稱為:" + methodName);