Results 1 to 6 of 6
  1. #1
    ProUnbeatable is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Question Need help with calculate the number of seconds

    I'm really new to java program and i need help with my homework assignment. I have no idea where to start it. Please help me out here is the question...

    1) Write a Java program to calculate the number of seconds that have passed since the stroke of midnight in London on New Years Eve, 1970. Your program should not be long, just a few lines of code. (Hint - don’t try and calculate the result yourself, browse through the Java API and find some help there…)


    hxxp://java.sun.com/j2se/1.4.2/docs/api/index.html

  2. #2
    ojn
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default

    Hint: Look at the System class.

  3. #3
    ProUnbeatable is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default

    is it public static long currentTimeMillis()? how do i use it...

  4. #4
    ojn
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default

    Have you read the API? If so, it should be pretty clear.

  5. #5
    ProUnbeatable is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default

    I'm reading it right now... the problem is i have never used API. I don't know how to use it...

  6. #6
    ojn
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default

    public static long currentTimeMillis()

    Returns the current time in milliseconds.
    What primitive type does it return? How can you use this type (declare it to a variable) to display the result? I'm sure you've learned that much.

Similar Threads

  1. calculate fft
    By ram.west in forum Advanced Java
    Replies: 2
    Last Post: 08-27-2008, 03:05 AM
  2. Replies: 1
    Last Post: 06-30-2008, 07:14 AM
  3. Replies: 0
    Last Post: 06-26-2008, 07:32 PM
  4. measuring time in nano seconds
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-06-2007, 12:11 PM
  5. Calculate what e1 and e2 should be
    By Legoland in forum New To Java
    Replies: 11
    Last Post: 07-02-2007, 06:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •