首页 > 其他 > 详细

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

时间:2015-09-24 23:54:42      阅读:208      评论:0      收藏:0      [点我收藏+]

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


 
程序流程图:

 技术分享

 

 

 

 

 

 

 

 

源程序代码:

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); 

       }

}

 

结果截图:

技术分享

 

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

原文:http://www.cnblogs.com/zuhaoran/p/4836803.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!