A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© ★星★星★ 中级黑马   /  2013-9-20 18:55  /  1183 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

学习毕老师的第二天的内容后,自己琢磨着写了个程序,还可以怎样改进                                             程序如下:
class IfTest
{
        public static void main(String[] args)
        {
                int a=3;
                int c=7;
                //这个程序为2013年10月份的日期查询表。
                //a表示7的倍数,b表示的是-1到5的常数。
                if (a>=1 && a<=4 )
                        System.out.println( "yes" );
                 else
                         System.out.println( "no" );

                 if (c>=-1 && c<= 5)
                        System.out.println( "yes" );
                 else
                         System.out.println( "no" );
               
                {
                        System.out.println( Integer.toBinaryString(c+a*7) );
                       
                        int m=  c+a*7;
               
                        System.out.println( c+a*7);

                        if (m>=1 && m<=31&&c>=-1 && c<= 5  &&a>=1 && a<=4 )
                        System.out.println( "以上结果是正确的" );
                 else
                         System.out.println( "以上结果是错误的" )



感谢你的指导!

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马