1. 程式人生 > 其它 >製作Ubuntu系統的USB啟動盤

製作Ubuntu系統的USB啟動盤

類圖

原始碼

package com.test;

public class StuNo {
    private static StuNo instance=null;
    private String no;
    
    private StuNo()
    {    
    }
    
    public static StuNo getInstance()
    {
        if(instance==null)
        {
            System.out.println("入學,分配學號!");
            instance
=new StuNo(); instance.setStuNo("20193922"); } else { System.out.println("返校,獲取舊號碼!"); } return instance; } private void setStuNo(String no) { this.no=no; } public String getStuNo() {
return this.no; } } Client.java package com.test; public class Client { public static void main(String a[]) { StuNo no1,no2; no1=StuNo.getInstance(); no2=StuNo.getInstance(); System.out.println("學號是否一致:" + (no1==no2)); String str1,str2; str1
=no1.getStuNo(); str2=no1.getStuNo(); System.out.println("第一次學號:" + str1); System.out.println("第二次學號:" + str2); System.out.println("內容是否相等:" + str1.equalsIgnoreCase(str2)); System.out.println("是否是相同物件:" + (str1==str2)); } }

測試截圖