package Test10;
import java.util.Scanner;
public class StringDemo20 {
public static void main(String[] args) {
//两个字符串相乘,乘积以字符串形式输出
//1.输入两个字符串
Scanner sc=new Scanner(System.in);
String num1=sc.next();
String num2=sc.next();
//2.定义方法把字符串转化成整数形式
int newnum1=changeNum(num1);
int newnum2=changeNum(num2);
int chengji=newnum1*newnum2;
String result=chengji+"";//将乘积转化为字符
System.out.println(result);
}
public static int changeNum(String str){
int num=0;
for(int i=0;i<str.length();i++){
char c=str.charAt(i);
int intchar=c-'0';
num=num*10+intchar;
}
return num;
}
}
运行结果: