Topic: 请高手指点!(输入一个字符,判断它是否假期)

  Print this page

1.请高手指点!(输入一个字符,判断它是否假期) Copy to clipboard
Posted by: yangzhen1983
Posted on: 2005-10-20 10:17

请尽量使用准确的文字描述作为标题
若新帖再無恰当标题,可能会被刪除

Original subject :
请高手指点!


import java.util.*;
class B{
  
  BitSet bs=new BitSet(366);
  int [] ho ={12,45,56,58,89,94,288,350};
  public void nn(){
    for(int i=0;i<8;i++)
   {
bs.set(ho[i]);
   }
}  

public boolean getho(int y){
   return bs.get(y);
    }
}
public class Ov{
  
  public static void main(String[]args){
   B b=null;
  try{ b.nn(); }catch(Exception et){}
    
    if (args.length>0)
     try{
{
    if(b.getho(Integer.parseInt(args[0])))
    {
      System.out.println("it is holiday");
      
    }
    else{System.out.println("no holiday");}
    }
     }
}

输入一个字符,判断它是否是一年中的假期;帮我看看怎么运行了没反映那?

2.Re:请高手指点!(输入一个字符,判断它是否假期) [Re: yangzhen1983] Copy to clipboard
Posted by: why
Posted on: 2005-10-20 11:51

> B b=null;
You need an instance of B, so it should be
B b = new B();

Please try to format your code properly.Sad


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923