public class F {
public static void main(String[] args) {
/**截取字符串,第4位以后的字符串用*代替*/
String s = "Hello Java World";
System.out.println("直接输出:" + s);
String a = s.substring(4,s.length());
for (int i = 0;i < a.length() ; i++){
a = a.replace(String.valueOf(a.charAt(i)),"*");
}
System.out.println("屏蔽输出:" + s.substring(0,4)+a);
}
}