亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

這個邏輯性,不好理解能解釋下面。大神???感謝------

這個邏輯性,不好理解能解釋下面。大神???感謝------

qq_小杜_1 2017-06-09 23:17:17
題目:輸入一行字符,分別統計出其中英文字母、空格、數字和其它字符的個數。import java.util.*;public class lianxi07 {public static void main(String[] args){int digital = 0;int character = 0;int other = 0;int blank = 0;char[] ch = null;Scanner sc = new Scanner(System.in);String s = sc.nextLine();--------------------------------------------下面的邏輯不太理解-----------------------------------------------ch = s.toCharArray();for(int i=0; i<ch.length; i++) {if(ch >= '0' && ch <= '9') {digital ++;} else if((ch >= 'a' && ch <= 'z') || ch > 'A' && ch <= 'Z') {character ++;} else if(ch == ' ') {blank ++;} else {other ++;}}---------------------------------------------------------------------------------------------------------------------System.out.println("數字個數: " + digital);System.out.println("英文字母個數: " + character);System.out.println("空格個數: " + blank);System.out.println("其他字符個數:" + other );}}
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 1943 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號