public class test2 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); System.out.printf("请输入16进制数字:"); String s = scanner.next(); String c= Integer.valueOf("s",16).toString(); System.out.println(String.valueOf(c));
} }
2: import java.util.Scanner;
public class test2 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); System.out.printf("请输入16进制数字:"); String s = scanner.next(); int d =Integer.parseInt(s); System.out.println(Integer.toString(d));
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
System.out.println("请输入16进制数字:");
String s = scanner.next();
System.out.println(Integer.parseInt(s,16));
}
}
------解决方案-------------------- 1
Java code
import java.util.Scanner;
public class test2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.printf("请输入16进制数字:");
String s = scanner.next();
String c = Integer.valueOf(s, 16).toString();
System.out.println(String.valueOf(c));
}
}
------解决方案--------------------
import java.util.Scanner;
public class Test {
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.printf("请输入16进制数字:"); String s = scanner.next(); String c = Integer.valueOf(s, 16).toString(); System.out.println(String.valueOf(c));