《Java实战开发经典》第五章5.3
2024-10-01 18:57:48
package xiti5;
public class Third {
public static void main(String[] args) {
T t=new T("want you to know one thing ");
t.tell();
}
}
class T{
private String str;
public T(String str){
this.str=str;
}
public void tell(){
char c[]=str.toCharArray();//将字符串分解为字符数组
int n=0;
int m=0;
for(int i=0;i<c.length;i++){
if(c[i]=='n'){
n++;
}else
if(c[i]=='o'){
m++;
}
}
System.out.println("该字符串中n出现了"+n+"次,o出现了"+m+"次");
}
}
最新文章
- java第三次作业
- springmvc No mapping found for HTTP request with URI in Dispatc
- JS添加删除DIV
- NGif, Animated GIF Encoder for .NET
- CodeForces Round 199 Div2
- html5 教程网站
- Eyeshot Ultimate 学习笔记(1)
- kaggle之手写体识别
- checkbox之checked的方法(attr和prop)区别
- SharePoint 2010 Form Authentication (SQL) based on existing database
- Django:(博客系统)使用使用mysql数据&;创建post/category/tag实体,并同步到数据中
- 【一天一道LeetCode】#21. Merge Two Sorted Lists
- 细说shiro之五:在spring框架中集成shiro
- Redis内存模型总结
- A1103. Integer Factorization
- WijmoJS 全面支持 Angular 7
- 【LOJ】#2269. 「SDOI2017」切树游戏
- brainfuck 解释器
- less常见的操作
- 端口安全检查shell脚本
热门文章
- 开源3D游戏引擎Irrlicht简介
- request.getSession().getServletContext().getRealPath(";";)获取工程目录 路径修改
- Fastboot线刷“复活”之刷机心得(三)——错误处理
- C#运算符小例子
- js插件---video.js如何使用
- js函数的属性和方法
- IIS7下设置AD单点登录
- MyEclipse下怎么配置Maven
- Android 如何获取Android RecyclerView滑动的距离
- OpenCV —— 轮廓