the code below demonstates the principle of the'recursive-call' that the programing beginner may be confused with,and each demonstrate was followed by a screenshot:

the first part of the code called in the main:

 String s2 = toBinary2(6, sb);

the actual code:

 static String toBinary2(long n, StringBuilder sb)
{
if(n > 0)
{
toBinary2(n / 2, sb);
sb.append(n % 2);
}
return sb.toString();
}

the relevant screenshot:

figure 01 - to binary

the second part of the code called in the main:

 int sum = sum(100000);

the actual code:

 static int sum(int num)
{
if(num == 1)
return 1;
return num + sum(num - 1);
}

the correspond screenshot:

recursive - simple screenshot but detail principle.的更多相关文章

  1. Simple screenshot that explains the singleton invocation.

    Here is the code: /* Some class,such as a config file,need to be only one.So we need to control the ...

  2. Simple screenshot that explains the non-static invocation.

    Here is the code: /* Instance invocation in the memory: */ package kju.obj; import static kju.print. ...

  3. Why AlloyFinger is so much smaller than hammerjs?

    AlloyFinger is the mobile web gesture solution at present inside my company, major projects are in u ...

  4. Pyhton开源框架(加强版)

    info:Djangourl:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC)风格的 ...

  5. Python开源框架

    info:更多Django信息url:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC) ...

  6. 一次日语翻译的Chrome插件开发经历

    序言 去年7月刚过了日语N2,想着今年考个N1,为了加深日语文化的了解,还有学习日语,平时免不了经常上日语网站. 但是毕竟水平有限,所以不免遇到不认识的单词,日语单词的一个特点就是很多单词你知道是什么 ...

  7. Android设计和开发系列第一篇:Notifications通知(Design)

    Design篇 Notifications The notification system allows users to keep informed about relevant and timel ...

  8. 整理 Xamarin.Forms - Plugins

    Open Source Components for Xamarin Xamarin官方整理的一些开源组件,有需要可以先到这里找 GitHub: xamarin/XamarinComponents: ...

  9. Plastic Sprayers Manufacturer - Ingenious Design Of Spray Plastic Bottle

    Plastic bottles are now an indispensable container in life. Plastic bottles will appear in all aspec ...

随机推荐

  1. Javascript禁止网页复制粘贴效果,或者复制时自动添加来源信息

    一.禁止复制 使用方法:在oncopy事件中return false oncopy="return false;" 1.禁止复制网页内容 <body oncopy=" ...

  2. Error creating bean with name 'bookDao'

    “Error creating bean with name 'bookDao' defined in ServletContext resource [/WEB-INF/applicationCon ...

  3. EAFP和LBYL 两种防御性编程风格

    EAFP:Easier to ask for forgiveness than permission 获得事后原理总是比事先得到许可要容易的多. 这个EAFP在python中表现的比较多.EAFP,T ...

  4. C++ Prime:switch内部的变量定义

    如果需要为某个case分支定义并初始化一个变量,我们应该把变量定义在块内,从而确保后面的所有case标签都在变量的作用域之外. case true: { // 正确,声明语句位于语句块内部 strin ...

  5. BZOJ2083: [Poi2010]Intelligence test

    2083: [Poi2010]Intelligence test Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 241  Solved: 96[Sub ...

  6. 【转】MFC下拉列表框的用法

    原文网址:http://blog.csdn.net/kinglimy/article/details/6452239 Combo Box (组合框)控件很简单,可以节省空间.从用户角度来看,这个控件是 ...

  7. HDU 3507 Print Article(DP+斜率优化)

     Print Article Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) ...

  8. Struts1、Struts2和SpringMVC剖析【转载】

    前段框架用了不少,今天就来做个总结.网上关于Struts1.Struts2.SpringMVC的文章有很多,这里的内容就是基于它们,来做个比较. 这三个框架是按照上面的顺序,依次出现的,它们都是对MV ...

  9. 【转】SVN linux命令及 windows相关操作(二)

    转自这里:http://www.uml.org.cn/pzgl/200904246.asp 1 安装及下载client 端 2 什么是SVN(Subversion)? 3 为甚么要用SVN? 4 怎么 ...

  10. 干货!如何正确使用Git Flow

    我们已经从SVN 切换到Git很多年了,现在几乎所有的项目都在使用Github管理, 本篇文章讲一下为什么使用Git, 以及如何在团队中正确使用. Git的优点 Git的优点很多,但是这里只列出我认为 ...