问个Java问题(急)

[复制链接]
查看11 | 回复4 | 2007-10-31 14:47:55 | 显示全部楼层 |阅读模式
楼上正解
回复

使用道具 举报

千问 | 2007-10-31 14:47:55 | 显示全部楼层
二楼是正解
回复

使用道具 举报

千问 | 2007-10-31 14:47:55 | 显示全部楼层
二楼正确
回复

使用道具 举报

千问 | 2007-10-31 14:47:55 | 显示全部楼层
反转的方法很多!一递归实现方法package com.zhh.test;public class TestSystemIn { public static void main(String[] args) {/*try { byte b = (byte) System.in.read();} catch (Exception e) { e.printStackTrace();}*/String str = "i love you!";reversal(str,str.length()); }public static void reversal(String strApply,int position){
if( position>= 1){ System.out.print(strApply.charAt(position - 1));
reversal(strApply,position - 1);}; }}
回复

使用道具 举报

千问 | 2007-10-31 14:47:55 | 显示全部楼层
方法很多。二楼的最方便也最经典!StringBuffer s = new StringBuffer("A quick brown fox jumps over a lazy dog");System.out.println(s.reverse());
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行