how do you do this method?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CTG

    how do you do this method?

    package mydiary_system;

    public class Pt_in_Time {
    private long NofSecSince1900 ;

    public Pt_in_Time( final long paramNofSecSinc e1900 )
    {
    /*can i do this ? */
    NofSecSince1900 = ParamNofSecSinc e1900
    }

    public boolean isItEarlier( final Pt_in_Time anotherPt_in_Ti me )
    {
    // can you do this in java ? //??????????????? ?? if not then how does this method shoudl look like?
    if (anotherPt_in_T ime >this.NofSecSin ce1900) return false else return true
    }
    }


  • perry

    #2
    Re: how do you do this method?

    syntax aside, can you better describe your application to me?

    - perry


    CTG wrote:[color=blue]
    > package mydiary_system;
    >
    > public class Pt_in_Time {
    > private long NofSecSince1900 ;
    >
    > public Pt_in_Time( final long paramNofSecSinc e1900 )
    > {
    > /*can <file://can> i do this ? */
    > NofSecSince1900 = ParamNofSecSinc e1900
    > }
    >
    > public boolean isItEarlier( final Pt_in_Time anotherPt_in_Ti me )
    > {
    > // c <file:// can>an <file:// can> you do this in java ?
    > //??????????????? ?? if not then how does this method shoudl look like?
    > if (anotherPt_in_T ime >this.NofSecSin ce1900) return false else return true
    > }
    > }[/color]

    Comment

    • Mihai

      #3
      Re: how do you do this method?

      CTG wrote:
      [color=blue]
      > package mydiary_system;
      >
      > public class Pt_in_Time {
      > private long NofSecSince1900 ;
      >
      > public Pt_in_Time( final long paramNofSecSinc e1900 )
      > {
      > /*can i do this ? */
      > NofSecSince1900 = ParamNofSecSinc e1900
      > }
      >
      > public boolean isItEarlier( final Pt_in_Time anotherPt_in_Ti me )
      > {
      > // can you do this in java ? //??????????????? ?? if not then how does
      > this method shoudl look like? if (anotherPt_in_T ime[color=green]
      > >this.NofSecSin ce1900) return false else return true }[/color]
      > }[/color]

      You need to create a member function to access the private variabile
      "NofSecSince190 0":

      public long GetTime()
      {
      return NofSecSince1900 ;
      }

      then in the function isItEarlier() call it:

      if (anotherPt_in_T ime.GetTime() > this.NofSecSinc e1900) return false
      else return true



      Comment

      Working...