Java Foundations, Chapter 1, Introduction

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What is Java bytecode?

*Java bytecode* is a low-level representation of a Java source code program. The Java compiler translates the source code into byte-code, which can then be executed using the Java interpreter. The bytecode might be transported across the Web before being executed by a Java interpreter that is part of a Web browser.

What do we mean by *syntax* and *semantics* of a programming language?

*Syntax* rules define how the symbols and words of a programing language can be put together. The *semantics* of a programming language instruction determine what will happen when that instruction is executed.

What is *white space*? How does it affect program execution? How does it affect program readability?

*White Space* is a term that refers to the spaces, tabs, and newline characters that separate words and symbols in a program. The compiler ignores extra white space; therefore, it doesn't affect execution. However, it is crucial to use white space appropriately to make a program readable to humans.

Give examples of two types of Java comments, and explain the differences between them.

// is a single line comment /* is a multi-line comment */

Chapter 1 Objectives:

1) Introduces the Java programming language. 2) Describe the steps involved in program compilation and execution. 3) Explore the issues related to problem solving in general. 4) Discuss the activities involved in the software development process. 5). Present an overview of object-oriented principles.

object

A fundamental entity in a Java program that represents something and provides services related to it.

method

A group of programming statements that is given a name.

object-oriented programming language

A language such as Java that uses objects as the fundamental elements of a program.

natural language

A language that humans use to communicate, such as English.

Java API

A library of software that we can use when developing programs.

assembly language

A low-level programming language that replaced binary digits with mnemonics.

bytecode

A low-level representation of a Java program that is not tied to a specific type of CPU.

compiler

A program that translates code in one language into equivalent code in another language.

syntax error

A programming error that violates the syntax rules of the language.

high-level language

A programming language that is expressed in phrases that are easier than machine language for a programmer to understand.

class library

A set of software classes that can be used when developing programs. (see Java API).

integrated development environment (IDE)

A set of software tools used to create, modify, and test a program.

editor

A software tool that allows one to enter text such as a program.

identifier

A word in a programming language.

Which of the following are *not* valid **Java identifiers**? Why? a. RESULT b. result c. 12345 d. x12345y e. black&white f. answer_7

All the identifiers shown are valid except *c. 12345* (an identifier cannot begin with a digit) and *e. black&white* (an identifier cannot contain the character &). The identifiers RESULT and result are both valid, but they should not be used in a program because they differ only by case (which is confusing and leads to errors). The underscore character in *f. answer_7* is valid.

class definition

An element in a Java program. It starts at the beginning of the first { and ends with the last }. All Java programs are defined using class definitions.

logical error

An error of programming statements that is given a name.

run-time error

An error that occurs during a program execution and causes the program to terminate abnormally.

reserved word

An identifier that has a special meaning in a program language and can be used only in predefined ways.

programming statement

An individual instruction in a programming language.

graphical user interface (GUI)

An interface to a program that consists of graphical elements such as windows and buttons.

All programs must be translated into a particular ____'s ______ language in order to be executed.

CPU, machine

method invocation

Calling a method to execute its code.

inheritance

Defining a class based on another that already exists.

What is the relationship between a high-level language and machine language?

High level language allow a programmer to express a series of program instructions in English-like terms that are relatively easy to read and use. However, in order to execute, a program must be expressed in a particular computer's machine language, which consists of a series of bits that is basically unreadable by humans. A high-level language program must be translated into machine language before it can be run.

____-level languages allow a programmer to ____ the underlying details of ____ language.

High, ignore, machine

program

a series of instructions that a computer executes one at a time.

The programmer is responsible for the _____ and _____ of a program.

accuracy, reliability

deprectated

an element that is considered old-fashioned and should not be used. This means that the author wants to remove this method, but didn't do this yet to not break backward compatibility. This also means, that you should not use this method, and if your are already using it, you should stop using it. The method could be marked as deprecated because another method exists that supersedes functionality of this method, or because method is unsafe or some other reason.

A class is a _______ of an object. ______ objects can be created from one class definition.

blueprint, Multiple

Java is ____-____. The uppercase and lowercase versions of a letter are ____.

case-sensitive, distinct

A Java _____ translates Java source code into Java ____, a low-level, architecture-neutral representation of a program.

compiler, bytecode

Identifier names should be ____ and ____.

descriptive, readable

The effort put into _____ is both crucial and ____-effective.

design, cost

Many different _____ environments exist to help you _____and _____ Java programs.

development , create, modify

You should adhere to a set of guidelines that establishes the way you ___ and ____ your programs.

format, document

A computer system consists of ____ and ____ that work in concert to help us solve ___.

hardware, software, problems

____documentation should provide insight into your ___. It should not be ____or belabor the ____.

inline, code, ambiguous, obvious

check

instruction in onyx in lab on blackboard.

What is *title case*? When is it used?

naming convention that uses uppercase for the first letter of each word for class names.

Comments do not affect a program's ____; instead, they serve to facilitate human ____.

processing, comprehension

Problem solving involves breaking a ____ down into _____ pieces.

solution, manageable

Each object has a ____, defined by its ____, and a set of ___, defined by its ____.

state, attributes, behaviors, methods

The program must be ______ correct or the compiler will not produce _____ .

syntactically, bytecode

Appropriate use of _____ space makes a program easier to read and understand.

white space

syntax

The rules of a language that dictate how vocabulary elements of the language can be used.

white space

The space, tab, and newline characters used to separate words and symbols in a program.

What is Hardware? What is Software?

This part of a computer system consists of its physical components, such as a circuit board, monitor, and keyboard. This is the programs that are executed by the hardware and the data that those programs use. One is tangible, whereas the other is intangible.

machine language

The language executed by a particular CPU

Java 2 Platform

The most recent Java technology

What are the primary concepts that support object-oriented programming?

The primary elements that support object-oriented programming are: *objects, classes, encapsulation, & inheritance.* An object is defined by a class, which contains methods that define the operations on those objects (the services they perform). Objects are encapsulated so that they store and manage their own data. Inheritance is a reuse technique in which one class can be derived from another.

What things can Java identifiers have and not have?

Java identifiers are the various words used when writing programs. An identifier can be any length and be composed of any combination of letters, digits, _(underscore), $, but cannot begin with a digit or use '&' symbol. An identifier is a letter followed by zero or more letters and digits. This includes _, $. Java digits include 0-9.

case-sensitive

Making a distinction between uppercase and lowercase letters. Java is case-sensitive.

program development 4 steps

PCED programming, compilation, execution, debugging.

semantics

Rules that define what a statement in a language means.

_____ rules dictate the form of a program. ______dictate the meaning of the program statements.

Syntax, Semantics

comment

Text included in a a program to make the program easier to understand for humans.

encapsulation

The characteristic of an object that means it protects and manages its own information.

Name the four basic activities that are involved in the software development process.

The four basic activities in software development are: 1. Requirements Analysis (deciding what the program should do). 2. Design (deciding how to do it). 3. Implementation (writing the solution in source code). 4. Testing (validating the implementation).


संबंधित स्टडी सेट्स

nursing care of child with an alteration in behavior, cognition, or development chapter 50

View Set

Louisiana History Chapter 2 Test 2 Review

View Set

Chapter 5. The Genus Homo and the Emergence of Us

View Set