Chapter 1 - Creating Java Programs Flashcards
The most basic circuitry-level computer language is _______ .
machine language Java high-level language C++
machine language
All computer programs, even high-level language programs, ultimately are converted to the lowest-level language, which is machine language. Machine language , or machine code , is the most basic set of instructions that a computer can execute. Each type of processor (the internal hardware that handles computer instructions) has its own set of machine language instructions. Programmers often describe machine language using 1s and 0s to represent the on-and-off circuitry of computer systems.
Languages that let you use an easily understood vocabulary of descriptive terms, such as read, write, or add, are known as languages.
procedural high-level machine object-oriented
high-level
A high-level programming language such as Java, Visual Basic, C++, or C# allows you to use English-like, easy-to-remember terms such as read, write, and add.
The rules of a programming language constitute its ________ .
syntax logic format objects
syntax
Every programming language has its own syntax , or rules about how language elements are combined correctly to produce usable statements. For example, depending on the specific high-level language, you might use the verb print or write to produce output. All languages have a specific, limited vocabulary (the language’s keywords ) and a specific set of rules for using that vocabulary. When you are learning a computer programming language, such as Java, C++, or Visual Basic, you are learning the vocabulary and syntax for that language.
A _______ translates high-level language statements into machine code.
programmer syntax detector compiler decipherer
compiler
After the program statements are written in a high-level programming language, a computer program called a compiler or interpreter translates the statements into machine language. A compiler translates an entire program before carrying out any statements, or executing them, whereas an interpreter translates one program statement at a time, executing a statement as soon as it is translated.
Named computer memory locations are called _______ .
compilers variables addresses appellations
variables
The typical procedural program defines and uses named computer memory locations; each of these named locations that can hold data is called a variable . For example, data might be read from an input device and stored in a location the programmer has named rateOfPay. The variable value might be used in an arithmetic statement, used as the basis for a decision, sent to an output device, or have other operations performed with it. The data stored in a variable can change, or vary, during a program’s execution.
The individual operations used in a computer program are often grouped into logical units called _______ .
procedures variables constants logistics
procedures
the individual operations used in a computer program are often grouped into logical units called procedures . For example, a series of four or five comparisons and calculations that together determine a person’s federal withholding tax value might be grouped as a procedure named calculateFederalWithholding(). (As a convention, this course will show parentheses following every procedure name.) As a procedural program executes its statements, it can sometimes pause to call a procedure . When a program calls a procedure, the current logic is temporarily suspended so that the procedure’s commands can execute. A single procedural program might contain any number of procedure calls. Procedures are also called modules, methods, functions, and subroutines. Users of different programming languages tend to use different terms. As you will learn later in this chapter, Java programmers most frequently use the term method.
Envisioning program components as objects that are similar to concrete objects in the real world is the hallmark of _______ .
command-line operating systems procedural programming object-oriented programming machine languages
object-oriented programming
programs that use a style of programming that involves creating classes, creating objects from those classes, and creating applications that use those objects. Contrast with procedural programming. Object-oriented programming is an extension of procedural programming in which you take a slightly different approach to writing computer programs.
Creating classes, which are blueprints for objects
Creating objects, which are specific instances of those classes
Creating applications that manipulate or use those objects
The values of an object’s attributes are known as its _______ .
state orientation methods condition
state
The values of the properties of an object are referred to as the object’s state . In other words, you can think of objects as roughly equivalent to nouns (words that describe a person, place, or thing), and of their attributes as similar to adjectives that describe the nouns.
An instance of a class is a(n) _____ .
method procedure object case
object
An object is a specific, concrete instance of a class. Creating an instance is called instantiation . You can create objects from classes that you write and from classes written by other programmers, including Java’s creators. The values contained in an object’s properties often differentiate instances of the same class from one another. For example, the class Automobile describes what Automobile objects are like. Some properties of the Automobile class are make, model, year, and color.
Java is architecturally _____ .
neutral oriented specific abstract
neutral
Some of the advantages that make Java a popular language are its security features and the fact that it is architecturally neutral . In other words, unlike many other languages, you can use Java to write a program that runs on any operating system (such as Windows, macOS, or Linux) or any device (such as PCs, phones, and tablet computers).
You must compile classes written in Java into _____ .
bytecode source code Javadoc statements object code
bytecode
The Java compiler converts the source code into a binary program of bytecode .
All Java programming statements must end with a _____ .
period comma closing parenthesis semicolon
semicolon
all Java program statements must end with a semicolon.
Arguments to methods always appear within ______ .
parentheses double quotation marks single quotation marks curly braces
parentheses
System.out.println(“First Java application”);
The string within quotation marks, “First Java application”, appears within parentheses because the string is an argument to a method, and arguments to methods always appear within parentheses following the method name.
In a Java program, you must use _____ to separate classes, objects, and methods.
commas semicolons dots forward slashes
dots
System.out.println();
The dots (periods) in System.out.println() are used to separate the names of the components in the statement.
All Java applications must have a method named _____ .
method() main() java() Hello()
main()
The name of the method is main(). As is the convention with Java methods, its identifier begins with a lowercase letter. Not all classes have a main() method; in fact, many do not. All Java applications, however, must include a class containing a public method named main(), and most Java applications have additional classes and methods. When you execute a Java application, the JVM always executes the main() method first.