关于switch的疑问

这名字也太难了 发表于2017年05月05日
<p>package demol;</p><p>import java.util.*;</p><p>public class Main {</p><p><br ></p><p> public static void main(String[] args) {</p><p> </p><p> </p><p> Scanner in=new Scanner(System.in);</p><p> int n=in.nextInt();</p><p> int m=0;</p><p> boolean b=true;</p><p> String s=&quot;&quot;;</p><p> if(n&lt;0)</p><p> {</p><p> b=false;</p><p> n=n*-1;</p><p> }</p><p> do</p><p> {</p><p> m=n%10;//这里明明倒着输出的 &nbsp;,为什么在switch里面有正向输出了里&nbsp;<code class="brush:java;toolbar:false" ><br ></code></p><p> n=n/10;</p><p> switch(m)</p><p> {</p><p> case 1:&nbsp;</p><p> s=&quot; yi&quot;+s;System.out.println(s);</p><p> break;</p><p> case 2:&nbsp;</p><p> s=&quot; er&quot;+s;System.out.println(s);</p><p> break;</p><p> case 3:&nbsp;</p><p> s=&quot; san&quot;+s;System.out.println(s);</p><p> break;</p><p> case 4:&nbsp;</p><p> s=&quot; si&quot;+s;System.out.println(s);</p><p> break;</p><p> case 5:&nbsp;</p><p> s=&quot; wu&quot;+s;System.out.println(s);</p><p> break;</p><p> case 6:&nbsp;</p><p> s=&quot; liu&quot;+s;System.out.println(s);</p><p> break;</p><p> case 7:&nbsp;</p><p> s=&quot; qi&quot;+s;System.out.println(s);</p><p> break;</p><p> case 8:&nbsp;</p><p> s=&quot; ba&quot;+s;System.out.println(s);</p><p> break;</p><p> case 9:&nbsp;</p><p> s=&quot; jiu&quot;+s;System.out.println(s);</p><p> break;</p><p> case 0:&nbsp;</p><p> s=&quot; ling&quot;+s;System.out.println(s);</p><p> break; </p><p> </p><p> }</p><p> }while(n!=0);</p><p> if(b==false) s=&quot;fu&quot;+s;</p><p> s=s.trim();</p><p> System.out.println(s);</p><p> </p><p>&nbsp; &nbsp; &nbsp;</p><p> }</p><p><br ></p><p>}</p><p>输出是这样的</p><p>-34</p><p>&nbsp;si//不是先读入了四后读入三吗,怎么输出又返回来了</p><p>&nbsp;san si</p><p>fu san si</p><p><br ></p>