标签:ati char sum 实现 倒序输出 用户输入 dde 字符 子串
代码:
package test;
public class test {
public static void main(String [] args){
int sum = 0;
String str = "this is test of java";
char c[] = str.toCharArray();
for(int i = 0;i<c.length;i++) {
if(c[i] == 's') {
sum++;
}
}
System.out.println(sum);
}
}
代码:
package test;
public class test {
public static void main(String [] args){
int sum = 0;
String str = "this is test of java";
char c[] = str.toCharArray();
for(int i = 0;i<c.length;i++) {
if(c[i] == 'i'&&c[i+1] == 's') {
sum++;
}
}
System.out.println(sum);
}
}
代码:
package test;
public class test {
public static void main(String [] args){
int sum = 0;
String str = "this is test of java";
char c[] = str.toCharArray();
for(int i = 0;i<c.length;i++) {
if(c[i] == ' '&&c[i+1] == 'i') {
sum++;
}
}
System.out.println(sum);
}
}
代码:
package test;
public class ban {
public static void main(String[] args) {
String str = "this is test of java";
for (int j = str.length()-1; j>=0; j--) {
char a = str.charAt(j);
System.out.print(a);
}
}
}
标签:ati char sum 实现 倒序输出 用户输入 dde 字符 子串
原文地址:https://www.cnblogs.com/yuanqizhizhi/p/11595133.html