Difference between revisions of "Compiling and the Java Virtual Machine"

From CompSciWiki
Jump to: navigation, search
m (added whitespace in summary)
(progress)
Line 3: Line 3:
 
You do not need to understand everything that is covered in this section. The point of this section is to give you a basic understanding of how lines of code becomes a program that your computer can run, and why Java does this differently. |Chapter_TOC=[[Java Fundamentals]]}}
 
You do not need to understand everything that is covered in this section. The point of this section is to give you a basic understanding of how lines of code becomes a program that your computer can run, and why Java does this differently. |Chapter_TOC=[[Java Fundamentals]]}}
  
=Heading=
+
What happens when you click on "Compile Java" in Textpad?  How do the lines of code that you write become a program that you can run on your computer?
  
'''Compiler''' A compiler is a program that translates text written in one programming language into another programming language.
+
=Compiling=
 +
 
 +
When you compile a program, a program called the '''Compiler''' translates text written in one programming language into another programming language.  Java is a programming language that is (relatively) comprehensible by humans; it takes a while to learn, but once you learn the fundamentals of Java, you can read another Java program and understand the basics of what it is doing.  A computer, on the other hand, uses a different language that is not really comprehensible by humans; each instruction is encoded as a short number (e.g., 3+4 might be 45 17).  The language that a computer understands is called machine code, or machine language.  This is explained in greater detail in Chapter 2's [[What Is Programming Part II|Further reading]].

Revision as of 11:26, 27 November 2007

COMP 1010 Home > Java Fundamentals


Introduction

Before you can run your Java program, you must compile it. Java is different than most programming languages because a program compiled on your computer will work on any other device that has a Java Virtual Machine, such as a cell phone.

   

{{{Body}}}

What happens when you click on "Compile Java" in Textpad? How do the lines of code that you write become a program that you can run on your computer?

Compiling

When you compile a program, a program called the Compiler translates text written in one programming language into another programming language. Java is a programming language that is (relatively) comprehensible by humans; it takes a while to learn, but once you learn the fundamentals of Java, you can read another Java program and understand the basics of what it is doing. A computer, on the other hand, uses a different language that is not really comprehensible by humans; each instruction is encoded as a short number (e.g., 3+4 might be 45 17). The language that a computer understands is called machine code, or machine language. This is explained in greater detail in Chapter 2's Further reading.