当前位置: 代码迷 >> Java相关 >> [求助]想将它用javac -d . Time3.java来编译,还是出现了诸多问题,是否是pri ...
  详细解决方案

[求助]想将它用javac -d . Time3.java来编译,还是出现了诸多问题,是否是pri ...

热度:110   发布时间:2006-10-26 12:25:31.0
[求助]想将它用javac -d . Time3.java来编译,还是出现了诸多问题,是否是private的问

程序代码如下,还是一本书上的例题,真是让人不可思议,不知道问题倒底出在什么地方
package c.czg;
import java.text.DecimalFormat;

public class Time3 extends Object {
private int hour ;
private int minute ;
private int second ;

public Time3 ()
{
setTime ( 0,0,0 );
}

public Time3 ( int h )
{
setTime ( h,0,0 );
}

public Time3 ( int h, int m )
{
setTime ( h,m,0 );
}

public Time3 ( int h,int m,int s )
{
setTime ( h,m,s );
}

public Time3 ( Time3 time )
{
setTime ( time.getHour(),time.getMinute(),time.getSecond() );
}

public void Time3 ( int h,int m,int s )
{
setHour ( h );
setMinute ( m );
setSecond ( s );
}

public void setHour ( int h )
{
hour = ( ( h>=0 && h<24 ) ? h:0 );
}

public void setMinute ( int m )
{
minute = ( ( m>=0 && m<60 ) ? m:0 );
}

public void setSecond ( int s )
{
second = ( ( s>=0 && s<60 ) ? s:0 );
}

public int getHour ()
{
return hour ;
}

public int getMinute ()
{
return minute ;
}

public int getSecond ()
{
return second ;
}

public String toUniversalString ()
{
DecimalFormat two = new DecimalFormat ("00");
return two.format ( getHour() ) + ":" +
two.format ( getMinute() ) + ":" +
two.format ( getSecond() );
}

public String toString()
{
DecimalFormat two = new DecimalFormat ("00");
return ( ( getHour() ==12 || getHour() == 0 ) ?
12: getHour() %12 ) + ":" +
two.format ( getMinute() ) +
two.format ( getSecond() ) +
( getHour()<12 ? "AM" : "PM" );
}

}

搜索更多相关的解决方案: javac  private  编译  

----------------解决方案--------------------------------------------------------
不知道你想问些什么
----------------解决方案--------------------------------------------------------
  相关解决方案