a到i有多少个字母

请教各位大神,用java计算a到i之间有多少个字母,用代码怎么表达出来?

尼古拉斯_汤普森_赵四
浏览 1692回答 3
3回答

望远

public static void main(String[] args) {    //java中的字符按Unicode编码方式编码,在参与运算的时候是按Unicode编码执行的,你可以去看一下编码表。      System.out.println("a-i的字符个数:"+('i'-'a'+1)); }

慕的地8582982

TZZTDTSYVCMGGFNARRAKKDFCSKNNKRHRKTJTNWWCZSDRTIVLSSQGPDTBQOOKBDDTHXPOVCRBKBGDXOKAUUEBBXFRBXWQPZJPYUKRGKEZZMDGDAOASCCCOEOVZLVFFHISVFGMACGQJJRBUEVTPMIZWZICZPSHEUKTXNWFWAJSITDTWLAQYVQAKFIFAYOACFHXUXGPZVGJRUXHFOWTWYOXFOKHEARHMOXAWTJMHZPTILOEOQADGUHXNXNDGWSVRSHDUILVMISVGOWGJODGCLITCFIEBRTILCODMCYPRUQGRQZBYNEODTJGETILPTXTVYOIXARVRUQZDNPLOXBXHDKUEKFPFCKARTDNKMWMIRVYULBLAWHLAXSBSPHPSUENRNCZQQLOLBDMWYIRUXOSBYUQNRUYAQGDGBFBENBXTWMXGPLOEHQAVGJLBVYWCRAXUQRBRORCYTQZPMCYOQHKSVTJZDSIMLZQHQNJNPTJXTDOLBSVKIKGVSJSDMVSJMJYUXUJGPXMWVXGDHJZDYVMEUWZPRHKAENXTDTCYHCSVFJRIKTEHEHRONCTQSVSPFILFIEGWODTWZQFUKGDTWMVLTQFVRUXADFWMODZAKUJFCFWPYGJBLGWSDZPRNDGQZJYNXCYOXOXUENKFMCLBEBFORORHCYAXNQFVRHNJYOSUDAJGUQLORAXMIRUQJRBVYOQTVYIOQTIRPYZPEBJSORSBRHDMQHPQNDGIENDHWKZIAPTPLHLNCFHQGCEGJMAPYNXSCFHXNXMIYHWXOQZWJWYVRUJZILDWFCLBKHDMVZLAQGVRUXZQTJYAQZVEOKBYWKHQTWGDFDZGOQTWAWLNKYBEBJNJTPLBXXTKNEAKNWFUWKADFQTPEBR

黄小凡

如下:public class Test{ public static void main(String[] args) { char ch = 'a'; int count = 0; while (ch<='i') { ch++; count++; } System.out.println(count); } }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java