设计思想:将字符串转化为数字,然后相加,最后输出和。


 
程序流程图:

 字符串转化为数字相加输出

 

 

 

 

 

 

 

 

源程序代码:

public class JavaAdd {

       public static void main(String[] args){

       String str1 = "12";

       String str2 ="23";

           int toInt1= 0 ;

           int otherInt=0 ;

           int taInt=0;

          

      

           toInt1 = Integer.parseInt(str1);

           otherInt = Integer.parseInt(str2);

           taInt=toInt1 +otherInt ;

            System.out.print(taInt); 

       }

}

 

结果截图:

字符串转化为数字相加输出

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2022-02-23
  • 2022-12-23
  • 2021-09-02
  • 2022-02-12
  • 2021-12-10
猜你喜欢
  • 2021-12-18
  • 2021-11-07
  • 2022-02-08
  • 2021-11-15
  • 2021-10-07
  • 2022-12-23
相关资源
相似解决方案