码迷,mamicode.com
首页 > 其他好文 > 详细

方法案例

时间:2019-05-09 09:21:01      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:method   col   int   oid   code   div   turn   eth   调用   

练习:判断一个字符(如:‘d‘),判断是大写字母、小写字母还是数字字符
 1 class Method07{
 2     //练习:判断一个字符(如:‘d‘),判断是大写字母、小写字母还是数字字符
 3     public static String result02(){
 4         char ch = ‘#‘;
 5         if(ch > ‘A‘ && ch < ‘Z‘){
 6             return "是大写字母";    
 7         }else if(ch > ‘a‘ && ch < ‘z‘){
 8             return "是小写字母";
 9         }else if(ch > 0 && ch < 9){
10             return"是数字字符";
11         }else{
12             return"是其他字符";
13         }
14     }
15 }
16 class Method08{
17     public static    void    main(String[ ]args){
18         System.out.println(Method07.result02());    //先调用方法,然后将返回结果再进行输出
19     }
20 }

执行结果:是其他字符

方法案例

标签:method   col   int   oid   code   div   turn   eth   调用   

原文地址:https://www.cnblogs.com/penphy/p/10836487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!