编写JAVA程序
import 。*;public class FormatString { public static void main(String[] args) throws IOException { InputStreamReader stdin = new InputStreamReader( ); BufferedReader reader = new BufferedReader(stdin); intln("enter 'quit' to quit the program!"); intln("enter a string:"); String line = adLine(); while (!"quit"。
equals( im())) { intln("your entered:"); intln(deleteSChar(line)); System。 intln("enter a string:"); line = adLine(); } } static String deleteSChar(String source) { if (source。
length() <= 0) return source; return placeAll("[s]+", ""); }}。
这个很简单,不要用循环,那还不如用C++了。你String类 里有API函数replace原型如下 String replace(char oldChar, char newChar) 返回一个新的字符串,它是通过用 newChar 替换此字符串中出现的所有oldChar 而生成的。输入一个字符串后你可以用下的处理一下就可以了(假定你的字符串是strName)strName= place("s","");strName= place("S",""); 分别是用空串代替"s","S"
public class Reverse { public static void main(String[] args) { intln("请输入一个字符串:"); String buf = new java.util.Scanner( ).nextLine(); intln("你输入的字符串是:"+buf); intln("删除s后输出:"+ placeAll("s","")); }}
答:要安装JDK和eclipse (1).JDK (一定要) 到 下载最新版的J2SE,当前最新版为jdk1.5.0_04 (2).eclipse (开发工具,可...详情>>
答:同学习的目的是什么? 1、为了一技之长,养家糊口 2、为了一个兴趣爱好 3、为了考试及格 4、为了.... 总之,不管是学什么,目的都是为了提高在某个方面的知识...详情>>
答:用代IP的QQ就可以看详情>>