Could someone explain my error?

I'm new to Java(I have recently entered an AP Computer Sciences class), and am having some difficulties with this code.
I'm trying to develop a clock. This is a very rudimentary clock wherein the new time (approximated in milliseconds) will show up in the line below the old time(repeating). When I try to compile the following code, I recieve an error stating that one of my lines is not a "[reachable] statement." My question is as such: how is the line not able to be conducted, and am I missing some line of code to help it operate?
The line of code that I am having trouble with is line 15, "if(ms == 100){" Any help would be appreciated.
(The following is my code)
public class Clock {
     public static void main(String[] args){
          double ms, s, min, h, clockwork;
          ms = 100;
          s = 0;
          min = 0;
          h = 0;
          clockwork = 1;
          for(;;) ms = ms + 1;
          if(ms == 100){
               s = s + 1;
               ms = 0;
          if(s == 60){
               min = min + 1;
               s = 0;
          if(min == 60){
               h = h + 1;
               min = 0;
          if(h == 12) h = 1;
          for( ; ; ) System.out.println("T:" + h + ":" + min + ":" + s + ":" + ms);
Also, if i want to just print the time on one line, how would i go about erasing the previous time?

Thank you all for your help tonight(now I understand loops :)). I got the code to run as i had concieved it in my mind. In case you are curious, below is the final code i produced.
public class Clock {     
     public static void main(String[] args){
          int ms, s, min, h, clockwork;
          //millisecond
          ms = 0;
          //second
          s = 0;
          //minute
          min = 0;
          //hour
          h = 0;
          //test variable, may not be used
          clockwork = 1;
          for(;;){
               ms=ms+1;
               System.out.println("T:" + h + ":" + min + ":" + s);
               if(ms==13999){
                    s=s+1;
                    ms=0;
                    if(s==59){
                         s=0;
                         min=min+1;
                         if(min==59){
                              min=0;
                              h=h+1;
                              if(h==13){
                                   h=1;
Message was edited by:
MCortez

Similar Messages

  • When running labview's test executive I recieve runtime error: Call to step "PRE-RUN" failed. Could someone explain this error?

    I have a set of vi's that work when run under labview. However, when calling these vi's from labview's test executive I recieve runtime error: Call to step "PRE-RUN" failed. in Assign Connector Pane.vi->Call Test.vi->Execute Pre-Run.vi->Test Executive. Could someone explain this error to me? (or ideally tell me how to fix it?) Thanks.

    Hello,
    There are any number of possible causes to this problem. Which version of Test Executive are you using? Have you upgraded your Test Executive recently? The latest version is 5.1.1. If you have changed anything about Test Executive on your computer recently, I recommend you perform a mass compile of all your VI libraries, as having different versions of the VIs on your system could often result in the "Call to Step XYZ Failed" errors. Also, are you using any DAQ or Analysis VIs in your steps? We have seen problems where the use of DAQ or Analysis VIs in the sequence can cause intermittent "Call to Step...Failed" errors. There are some KnowledgeBase entries on our website that discuss this problem. Are you using the Test Executive in the VI environment, or
    as an executable? Again, there are some problems with using Test Executive as an executable that result in these errors, and there are also KnowledgeBase entries that discuss these problems.
    If you have a pared-down application that demonstrates the problem, feel free to send me your VIs and your .seq file and I will try to reproduce the problem.
    Alternatively, I would suggest you visit www.ni.com/teststand to learn about TestStand, our state-of-the-art Test Sequencing software that completely outperforms Test Executive. It is very easy to use and much more powerful, and we have a top-notch support team available dedicated exclusively to supporting TestStand. As you are probably aware, we are no longer developing Test Executive, and instead are concentrating our efforts on making TestStand the penultimate solution for all our customers' test sequencing needs.
    I appreciate your patience on this issue. Please let me know if I can offer further assistance.
    Have a pleasant weeken
    d.
    Sincerely,
    Darren Nattinger
    Applications Engineer
    National Instruments
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Could someone explain to me why Flash virtual tours don't work after update to Flash Player 10.1?

    Hello there,
    Could someone explain to me why Flash virtual tours don't work after update to Flash Player 10.1?
    Thanks!

    www.privium.nl
    klick the icon image 'virtual tour' upper right corner.
    This works on my other pc, on which I did not update to 10.1 ...
    (I produced this virtual tour; it is stored on the FTP server of the service provider I use for this)
    Awaiting your reply,
    Regards,

  • Could someone explain why mds is using so much CPU?

    Could someone explain what mds is doing if my Mac has been indexed (don't see activity in Spotlight menu bar icon) & I haven't recently added a lot of files?
    I noticed my Mac was slowing down for a while so I looked in Activity Monitor & it says mds is running at 60% CPU. Isn't this something to do with Spotlight indexing?

    If you recently upgraded the OS or installed an application that includes a metadata parser for spotlight (such software generally comes in the form of a package instead of a single icon), it will force spotlight to reindex. Also, restoring from a backup does the same thing.
    Also, if you used mdutil to disable spotlight indexing on the volume and then reenable it, it will force a reindexing.

  • Could someone explain what is wrong with this refind expression?

    Hi, could someone explain what is wrong with this refind expression
    faultCode:Server.Processing faultString:'Unable to invoke CFC - Malformed regular expression "^[0-2][0-9][/][0-1][0-2][/][1-2][0-9]{3}+$".'
    thanks

    ^[0-2][0-9][/][0-1][0-2][/][1-2][0-9]{3}$ works,
    thanks
    dates 12/12/2007matching

  • Could someone explain me about tools like "RICEF"

    Hi Guys,
    Could someone explain me about tools like "RICEF"(I dont know if iam spelling it correctly) and ASAP methodology. Iam wondering how this are related to SAP upgrade and fresh SAP implementation.
    Many thanks in advance.
    Warm Regards,
    Garrick.

    Hi
    It would be helpful to go through the help document of ASAP Methodology.
    The following information may clarify some doubts/requirements you have.
    Generating the Project IMG through ASAP:
    After you have set the project scope, the next step is to generate the Project IMG. From the Business Process Master List (BPML), you can directly access the IMG activities relevant for configuring each process.
    BPML: The Business Process Master List, along with the Business Blueprint, is a key result of the second phase of the Roadmap. Microsoft Excel tables contain the SAP scenarios, process groups, and processes that have been set in scope in the SAP Reference Structure, and are crucial for configuring your SAP System. In Realization, the third phase of the Roadmap, the BPML provides the basis for monitoring and steering test activities and for configuring your SAP System. It contains the titles of the structure items, and displays the status, the owner, links to documentation and links to the SAP System. Amongst other things, the BPML allows you to:
    1) Set your baseline and final scope. These are used for baseline and final configuration.
    2) Access the Project IMG and specific IMG activities assigned to structure items.
    3) Access integration test plans, which help you carry out all required integration tests.
    The Prerequisite is you have set the project scope.
    Process Flow to use the Business Blueprint as a basis for configuring your SAP System:
    1) Set the project scope.
    2) Generate the Project IMG.
    3) Generate the BPML.
    4) From a specific processes in the BPML, you can go to the relevant IMG activities and make Customizing settings.
    Hope this information provides information
    Check the following link for downloading the complete reference document on ASAP.
    http://help.sap.com/printdocu/core/print46b/en/data/en/pdf/SVASAP.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/SVASAQADBCBI/QADBCBI.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/SVASACCT/SVASACCT.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/SVASAPROZ/SVASAPROZ.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/SVASQADBS/Q&ADBSTRUCSTAN.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/SVASAPE/SVASAPE_01.pdf
    Regards

  • Could someone explain the Factory Method Design Pattern

    Hi Experts.
    Could someone please explain for me the Factory Method Design Pattern. I read it a little and I understand that it is used in JDBC drivers but i'm not clear on it.
    Could someone explain.
    Thanks in advance
    stephen

    Basically, you have one class that's sole purpose is to create instances of a set of other classes.
    What will usually happen is you have a set of related classes that inherit from some base class. We'll say for example that you have a base class CAR and it has sub-classes FORD, GM, HONDA (sorry Crylser). Instead of having the user call the constructors for FORD, GM, and HONDA, you can give the user a Factory Class that will give him a copy. We'll call our factory class Dealership. Inside dealership, you can have a static function :
    public static Car makeCar(String type)
    if(type.equals("FORD")
    return new FORD();
    else if(type.equals("GM")
    return new GM();
    else if(type.equals("HONDA")
    return new HONDA();
    So when the user needs a car, they will just call
    Dealership.makeCar("FORD").
    This is a good way to hide the implementation of your classes from the user, or if you require complex initialization of your objects.
    Another good example of this is in the Swing library. To get a border around a component, you call static methods on BorderFactory.
    Hope this helped.
    Ed

  • Could someone explain what is Object?

    Could someone explain what is Object? I have a little
    idea what is it, but not sure. Please give me some
    concret example. Thanks.

    An object is an Instance of a class. A class describes a uniwue entity with behaviors and attributes. For example you can consider your arm.
    public class Arm {
      /** How many hairs on the arm. */
      private int hairCount;  // <== This is an attribute
      /** This is a method to set the hairCount Variable.
       * We dont let the outside user set it directly because that would
       * create problems if we wanted to change its implementation to
       * use a float. In addition we might have logic in this setter to
       * prevent bad data.
      public void setHairCount(final int hairCount) {
        // this is a good example of logic in the set method that we dont
        // want the user to bypass.
        if (hairCount < 0) {
          throw new IllegalArgumentException();
        this.hairCount = hairCount; // <-- Note how we have to use this. to
                                    //     access the instance variable
                                    //     insead of the parameter.
      /** This is a method to move the arm.
       * This is behavior of the class. ONLY behavior pertaining to an arm
       * belongs in the arm class. For example, the method "sneeze" would
       * not belong here but be in the Nose class instead. You can see then
       * that each class describes an entity.
      public void move() {
        // code to move the arm.
    }We have only ONE class per type but we can have many objects. For example the description of an arm does not change no matter who'se arm it is. The data in the class changes but not the actual essence of the arm. So we instantiate two arms for every person (assuming they arent disabled). To instantiate is to create a new object like so.
    Arm myarm = new Arm(): This creates a new object that we can work with.
    So consider the old inteview question of, "What is the difference between a class and an object?" The answer is, "A class is a map or desription of an object; whereas an object is a descrite instance of a class."

  • I know this isn't really the right place to ask, but could someone explain why when I open Portal 2, that I got off steam and spent a whole day downloading, keeps crashing when I click the Campaign/Single Player mode. It Freezes and then crashes. Help!

    I know this isn't really the right place to ask, but could someone explain why when I open Portal 2, that I got off steam and spent a whole day downloading, keeps crashing when I click the Campaign/Single Player mode. It Freezes and then crashes. Help!

    I know this isn't really the right place to ask...
    Uhm, why don't you go to the right place, then? There are several Steam/Portal forums out there...

  • ParseInt and radix: could someone explain to me what they are ?

    Hi ,
    could someone explain to me in simple words, and maybe with an example, what is the radix, and what "16" means ?
    String fields[] = line.split( "\\s+" );
       // Field 2 : POS
       // Field 3 : Number of words in the Synset (in hex)
        // Field 4 : First word in the Synset
    int words = Integer.parseInt( fields[3], 16 );Thank you !
    Grazia

    Short answer: Radix is the base, 16 means treat the string as a base 16 (hex) number.
    Long answer: Read the documentation (see link provided by jverd). It is very good to understand. Also, look at the following link:
    http://wwwacs.gantep.edu.tr/foldoc/foldoc.cgi?radix� {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Could someone explain how to use of the object Thermometer?

    Hi to all,
    please, could someone write a real example explaining how to use the thermometer in order to indicate the progress of a process like to submit a document?
    I need to do it exactly to indicate this process in Adobe Reader.
    Thanks.
    Dan

    Sorry but I surely have explained my problem badly. I understand how to use the object thermometer perfectly.
    I need to use this object in order to determine the progress of the document's transference when I submit a PDF form from Adobe Reader.
    I'm having problems when I try to do this, and I would like to know if there exists some way to do it.
    b I have tried the following:
    var t = app.thermometer;
    t.duration = 1000;
    // How can I know this value?
    t.begin();
    t.text = "Please wait";
    // Is this a madness?
    while( event.target.submitForm( { cURL: [...], cSubmitAs: [...] } ) )
       t.value++;
    t.end();
    Thank you for your time
    Dan

  • Could Someone Explain Interfaces in English Please?

    Hi Everyone-
    I'm new to Java. I've been reading "Learning Java" from O'Reilly. From what I understand, Interfaces are sort of a structural framework that lists certain methods. Any class that implements an interface must contain this "structure" and any objects intantiated using this class will be of the interface type? Is this correct? If not can someone explain interfaces in laymen's terms and the what is the usefulness of implementing Interfaces?
    Thanks.
    SA

    I'm new to Java. I've been reading "Learning Java"
    from O'Reilly. From what I understand, Interfaces are
    sort of a structural framework that lists certain
    methods. Any class that implements an interface must
    contain this "structure" ...OK so far...
    and any objects intantiated
    using this class will be of the interface type? Is
    this correct? It depends what you mean by "interface type". An interface can be said to define a type. So a class that implements that interface implements that type, and an object instantiated from that class is an instance of that type.
    If not can someone explain interfaces in
    laymen's terms and the what is the usefulness of
    implementing Interfaces?The utility of interfaces is that, without being tied down to particular implementations, allows types of objects to be defined.
    For example....is there a doctor in the house? Say:
    1) a Doctor is:
    - human
    - has gone to medical school
    - heals the sick
    2) a Norwegian is:
    - a person from Norway (assume we've defined "person" at this point)
    3) a Canadian is:
    - a person from Canada
    So:
    4) a Norwegian Doctor is a person from Norway who fulfills the qualifications to be a doctor
    5) a Canadian Doctor is a person from Canada who fulfills the qualifications to be a doctor
    6) a Canadian who is not a Canadian Doctor, is a person from Canada who does not fulfill the qualifications to be a doctor.
    If your appendix is about to burst, you need a doctor. You don't care if the doctor is Canadian or Norwegian (assume everybody including yourself speaks Esperonto so there aren't any language issues). You do care deeply if the person trying to remove your appendix is a Canadian but not a Canadian doctor.
    If you were establishing a hospital, you'd want doctors. If you were to write this in code, you'd have something like:
    Hospital.hireDoctor(Doctor doc);meaning, that method in the Hospital class will hire a doctor, which is the important part. So this would work:
    Doctor doc = NorwegianMedicalSchool.createDoctor();
    Doctor doc_eh = CanadianMedicalSchool.createDoctor();
    yourHospital.hireDoctor(doc);
    yourHospital.hireDoctor(doc_eh);The point is, you can write your Hospital code without knowing precisely how "Doctor" is implemented -- whether the doctors come from Canada or Norway. You just write it as appropriate given that you have a Doctor. And then when a Doctor is created by a Japanese medical school, it doesn't break your code. This is why interfaces are said to define "contracts" -- an interface defines what something is (i.e., what it does), and you can make your code insist on getting something that does that (fulfills the contract).
    Does this make any sense? Have I offended the Canadians? Probably.

  • Could someone explain the select comparison

    I am supposed to compare inputs on 2 numeric controls and if they are equal they will turn on an LED. I figured out how to do it with the = sign but I am supposed to use the select comparison. Could someone please help me?
    Solved!
    Go to Solution.

    No, you would not have to have another front panel Boolean to use the Select function. You could directly wire the results of anything that returns a True/False. You can also use block diagram constants.
    Message Edited by Dennis Knutson on 01-20-2010 09:47 PM

  • Could someone explain cell coloring

    Hi all,
    I have a Jtable and I want to change the background color of some cells. I know this is well covered here as I have been searching through past posts for the last 2 hours.
    every post says the same to change the background color I will need a cellrenderer. the problem is i dont understand what all this means. i tried the tutorial it went over my head.
    could someone please take me through the steps. I can post my code if needed.
    all help appreciated.

    Visit my website http://www.mekongtech.com check out java page.
    There is sample code that specifically fits your needs.
    Need more hints in details? Email me, I can help.
    Good luck.

  • Could someone explain the following applications?

    I am using AppQLaunch and the following applications puzzle me.. None of them open up when I click on them (not standalone exe files?) but they must fill some meaningful purpose I am sure?
    -MsgUrlHandler
    -NOT
    -SMS (brings up System error -2 , why?)
    -SysApp
    -akncapserver
    -aknnfysrv
    -essysapp
    -lmsrvapp
    -psdk_lmsrvapp
    If someone could explain those, I would be thankful!

    Probably they're all mostly operating system background services or "engines" (or application supplied, if you have installed additional software yourself). Few are documented in any user or developer documentation.
    Some of them might be documented in, e.g, Symbian OS internals documentation or books like this one:
    http://developer.symbian.com/main/learning/press/books/os_internals/index.jsp
    For example, "akn" refers to "Avkon", which is the Nokia S60 user interface/middleware/runtime/application layer on top of the Symbian base operating system.

Maybe you are looking for

  • Has anyone else had Mountain Lion 10.8.2 file copying trouble?

    Has anyone had any trouble with file copying to external disks? I have used a third party programme called "Synchronize! Pro X" (SyncPX) for many years with OS X up to 10.5.8 and it has never given any trouble at all.  In July I bought a new MacBook

  • Problem in JFileChooser

    I have got a problem here. Here I have a JFileChooser, I want to add in a FileFilter, and user could only see some type of file. But as long as I try to get the extension....It wont compile, could any one teach me how to get the extension of a file i

  • Three Way Switch not working

    Hi, i just bought a 4th-gen shuffle, and I've been using it with satisfaction since Saturday. Then yesterday i finished to listen to some music and I wanted to turn it off, so I slid the switcher to the right. The problem is that it won't turn off, n

  • Video ok on TV,  but photo impossible on TV

    I have connected my ipod 80 on TV; it's ok to see video on tv, but I can't see photography from ipod on the tv. con you help me ?

  • Two iPhones different numbers ring at sometime how to turn this off?

    I have 2 iphones Both ring at sometime when someone calls not everyone- Want to turn this off - cannot find where to do this in settings Thanks