黑马程序员技术交流社区
标题:
这个程序还可以怎样改进呢?
[打印本页]
作者:
★星★星★
时间:
2013-9-20 18:55
标题:
这个程序还可以怎样改进呢?
学习毕老师的第二天的内容后,自己琢磨着写了个程序,还可以怎样改进 程序如下:
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( "以上结果是错误的" )
感谢你的指导!
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2