

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


ZooKeeper Example with Two Classes The following two classes make up a project called Zoo. The first class is the one where execution begins. Execution begins with its main method. That method instantiates the second class, Panda. It then runs the instance of the Panda class. /*
Editing, compiling and running a program The editor is used to create the .java file. The compiler then translates the Java programming language into Java bytecode. This is an intermediate code that can be run on a number of computers. The Java Virtual Machine (JVM) executes the program. Errors can occur both in compiling and running. The compiler checks for syntax errors. But there still may be run-time errors. These you have to find yourself when the program is run on the JVM. Syntax errors are errors in grammar, using the language. Run-time errors are errors in semantics, what the programmer intended. They are usually much harder to find. Syntax errors are things like missing semicolons. Run-time errors can be incorrect computations or errors in logic. They are often called bugs. You usually have to work on the after a break. Otherwise you can get stuck and not see where you have made a mistake. The following diagram shows the process. eclipse editor ZooKeeper.java Panda.java Java Compiler javac ZooKeeper.class Panda.class Output to screen