This link has been bookmarked by 11 people . It was first bookmarked on 25 Sep 2008, by William Hummel.
-
30 Jan 15
-
Syntax rules specify the basic vocabulary of the language and how programs can be constructed using things like loops, branches, and subroutines
-
A semantically correct program is one that does what you want it to.
-
All programming in Java is done inside "classes."
-
the name of the class, also serves as the name of the program. Not every class is a program
-
When you tell the Java interpreter to run the program, the interpreter calls this main() subroutine, and the statements that it contains are executed. These statements make up the script that tells the computer exactly what to do when the program is executed. The main() routine can call other subroutines that are defined in the same class or even in other classes, but it is the main() routine that determines how and in what order the other subroutines are used.
-
The word "public" in the first line of main() means that this routine can be called from outside the program.
-
-
30 Oct 12
-
The rules that determine what is allowed are called the syntax of the language.
-
The meaning of a program is referred to as its semantics
-
A semantically correct program is one that does what you want it to.
-
Using the language correctly is not the same as using it well. For example, a good program has "style."
-
pragmatics.
-
In order to define a program, a class must include a subroutine named main
-
The word "public" in the first line of main() means that this routine can be called from outside the program.
-
-
09 Dec 11
-
syntax
-
Using the language correctly is not the same as using it well
-
pragmatics
-
subroutine call statement.
-
variable declarations
-
-
19 Dec 10
-
The rules that determine what is allowed are called the syntax of the language.
-
The meaning of a program is referred to as its semantics.
-
follows conventions
-
overall design that will make sense
-
easy for people to read and to understand
-
These aspects of programming are sometimes referred to as pragmatics.
-
syntax, the semantics, and some of the pragmatics
-
"built-in subroutine"
-
System.out.println
-
comments
-
comment that can extend over many lines. That type of comment begins with /* and ends with */
-
begins with // and extends to the end of a line
-
-
10 Sep 09
-
A syntactically correct program is one that can be successfully compiled or interpreted
-
The meaning of a program is referred to as its semantics. A semantically correct program is one that does what you want it to.
-
good program has "style." It is written in a way that will make it easy for people to read and to understand. It follows conventions that will be familiar to other programmers. And it has an overall design that will make sense to human readers
-
subroutine call statement. It uses a "built-in subroutine" named System.out.println to do the actual work
-
Java has two types of comments. The first type, used in the above program, begins with // and extends to the end of a line. The computer ignores the // and everything that follows it on the same line. Java has another style of comment that can extend over many lines. That type of comment begins with /* and ends with */.
-
Not every class is a program. In order to define a program, a class must include a subroutine named main, with a definition that takes the form:
public static void main(String[] args) { statements } -
When you tell the Java interpreter to run the program, the interpreter calls the main() subroutine, and the statements that it contains are executed. These statements make up the script that tells the computer exactly what to do when the program is executed. The main() routine can call subroutines that are defined in the same class or even in other classes, but it is the main() routine that determines how and in what order the other subroutines are used.
The word "public" in the first line of main() means that this routine can be called from outside the program. This is essential because the main() routine is called by the Java interpreter, which is something external to the program itself.
-
-
25 Sep 08
-
A program is a sequence of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form that the computer can use. This means that programs have to be written in programming languages.
-
This means that programs have to be written in programming languages. Programming languages differ from ordinary human languages in being completely unambiguous and very strict about what is and is not allowed in a program. The rules that determine what is allowed are called the syntax of the language. Syntax rules specify the basic vocabulary of the language and how programs can be constructed using things like loops, branches, and subroutines.
-
So, to be a successful programmer, you have to develop a detailed knowledge of the syntax of the programming language that you are using. However, syntax is only part of the story. It's not enough to write a program that will run -- you want a program that will run and produce the correct result! That is, the meaning of the program has to be right. The meaning of a program is referred to as its semantics. A semantically correct program is one that does what you want it to.
-
a good program has "style." It is written in a way that will make it easy for people to read and to understand. It follows conventions that will be familiar to other programmers. And it has an overall design that will make sense to human readers. The computer is completely oblivious to such things, but to a human reader, they are paramount. These aspects of programming are sometimes referred to as pragmatics.
-
Here is a Java program to display the message "Hello World!". Don't expect to understand what's going on here just yet -- some of it you won't really understand until a few chapters from now:
// A program to display the message // "Hello World!" on standard output public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } // end of class HelloWorld -
In the case of Java, the program is compiled into Java bytecode, not into machine language.
-
A built-in subroutine is one that is already defined as part of the language and therefore automatically available for use in any program.
-
The command that actually displays the message is:
System.out.println("Hello World!");This command is an example of a subroutine call statement. It uses a "built-in subroutine" named System.out.println to do the actual work.
-
Everything else in the program is required by the rules of Java syntax. All programming in Java is done inside "classes." The first line in the above program (not counting the comments) says that this is a class named HelloWorld. "HelloWorld," the name of the class, also serves as the name of the program. Not every class is a program. In order to define a program, a class must include a subroutine named main, with a definition that takes the form:
public static void main(String[] args) { statements } -
When you tell the Java interpreter to run the program, the interpreter calls the main() subroutine, and the statements that it contains are executed. These statements make up the script that tells the computer exactly what to do when the program is executed.
-
The word "public" in the first line of main() means that this routine can be called from outside the program. This is essential because the main() routine is called by the Java interpreter, which is something external to the program itself.
-
As noted above, a subroutine can't exist by itself. It has to be part of a "class". A program is defined by a public class that takes the form:
public class program-name { optional-variable-declarations-and-subroutines public static void main(String[] args) { statements } optional-variable-declarations-and-subroutines }
-
The name on the first line is the name of the program, as well as the name of the class. If the name of the class is HelloWorld, then the class must be saved in a file called HelloWorld.java. When this file is compiled, another file named HelloWorld.class will be produced. This class file, HelloWorld.class, contains the Java bytecode that is executed by a Java interpreter. HelloWorld.java is called the source code for the program. To execute the program, you only need the compiled class file, not the source code.
-
The layout of the program on the page, such as the use of blank lines and indentation, is not part of the syntax or semantics of the language. The computer doesn't care about layout -- you could run the entire program together on one line as far as it is concerned. However, layout is important to human readers, and there are certain style guidelines for layout that are followed by most programmers.
-
-
20 Mar 08
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.