a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 91|回复: 0

[考试试题] 2012JAVA模拟试题及答案:编程题7

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
【程序7】   
7 z8 V- A, N4 W# d. L题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。   
, a; \& d  Y, timport java.util.*;+ \% `4 M/ ?& ~% s5 w
public class lianxi07 {
$ D2 }$ h1 A7 {7 I1 m1 Bpublic static void main(String[] args) {
% o5 W7 p2 E% x& _9 c3 W! O7 \) Sint digital = 0;
! |: G0 j; x; M! J$ hint character = 0;
1 U( V8 r4 F. p0 o: |; W+ o1 sint other = 0;
; D: O/ h. b2 |' Q& N$ U+ {int blank = 0;
/ J8 t8 Z1 T# m& z0 O     char[] ch = null;
* N  Q& K, J, r' _     Scanner sc = new Scanner(System.in);
5 n% v& X) s# d& C     String s = sc.nextLine();
) }2 s2 W  t( i     ch = s.toCharArray();$ s: b1 V) h: E2 f2 O$ c. [
     for(int i=0; i= '0' && ch = 'a' && ch  'A' && ch
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-6 00:19 , Processed in 0.575062 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表