import java.util.*; public class Main { public static void main(String[] args){ Scanner s = new Scanner(System.in); String m,n; while (s.hasNext()){ m=s.next(); n=s.next(); int i = Integer.parseInt(m, 16); int j = Integer.parseInt(n, 16); System.out.println(i+j); } } }總結: 重點在於 一個以字符串形式的16進制的數如何轉化爲int