chapter 3 - syntax + errors + debugging

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/85

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

86 Terms

1
New cards

Size

Programming languages have small vocabularies compared to natural languages.

2
New cards

Rigidity

In a programming language, one must get the syntax absolutely correct.

3
New cards

Literalness

Computers follow instructions in a very literal manner.

4
New cards

Vocabulary of a language

The set of words and phrases used in a programming language. An example of an item in the vocabulary of Java is 'class'.

5
New cards

Syntax rule in Java

A guideline that defines the structure of statements in Java. An example is the requirement that every statement must end with a semicolon.

6
New cards

Expression (x + y) * z

This expression means to first add the values of x and y, and then multiply the result by z.

7
New cards

Differences between programming languages and natural languages

  1. Programming languages have strict syntax rules, while natural languages are more flexible. 2. Programming languages are designed for machine understanding, whereas natural languages are for human communication.
8
New cards

Primitive data types in Java

These include numbers (both integer and floating-point), characters, and Booleans.

9
New cards

Objects in Java

Instances of classes that can be manipulated and sent messages.

10
New cards

Concatenation operator

An operator used to combine strings in Java.

11
New cards

Numeric data types

Data types in Java that represent numbers, including int and double.

12
New cards

int data type

A numeric data type in Java that uses 4 bytes of storage and has a range from -2,147,483,648 to 2,147,483,647.

13
New cards

double data type

A numeric data type in Java that uses 8 bytes of storage and has a range from -1.7976931348623157E+308 to 1.7976931348623157E+308.

14
New cards

short data type

A numeric data type in Java that uses 2 bytes for small integers.

15
New cards

long data type

A numeric data type in Java that uses 4 bytes for large integers.

16
New cards

byte data type

A numeric data type in Java that uses 1 byte for very small integers.

17
New cards

float data type

A numeric data type in Java that uses 4 bytes for smaller, less precise floating-point numbers.

18
New cards

Literals

Items in a program whose values do not change, restricted to primitive data types and strings.

19
New cards

Example of numeric literals

Examples include the numbers 5.0 and 9.0, and the string 'Enter degrees Fahrenheit: '.

20
New cards

Storage requirements for int

4 bytes.

21
New cards

Storage requirements for double

8 bytes.

22
New cards

Numeric calculations

A central part of most programs, often following the format: input numeric data, perform calculations, output numeric results.

23
New cards

Temperature conversion program

An example program that adheres to the format of manipulating numeric data types.

24
New cards

Range of int

-2,147,483,648 to 2,147,483,647.

25
New cards

Range of double

-1.7976931348623157E+308 to 1.7976931348623157E+308.

26
New cards

Java's syntax for primitive data types

Involves combining them in expressions using operators like addition and multiplication.

27
New cards

Java's syntax for objects

Involves sending messages to objects.

28
New cards

Instantiation of objects

Objects must be instantiated before use, unlike primitive data types.

29
New cards

Examples of numeric data types

int and double are examples of numeric data types in Java.

30
New cards

Numeric literal

A representation of a number in code.

31
New cards

Integer

A whole number without a fractional component.

32
New cards

Negative integer

An integer that is less than zero.

33
New cards

Floating-point number

A number that has a decimal point.

34
New cards

Exponential notation

A way to express numbers as a decimal followed by a power of 10.

35
New cards

Scientific notation

Another term for exponential notation.

36
New cards

Variable

An item whose value can change during the execution of a program.

37
New cards

Variable declaration statement

A statement that specifies the type of a variable before it is used.

38
New cards

Constant

A variable whose value cannot change after it is initialized.

39
New cards

Final keyword

A keyword used to declare a constant in Java.

40
New cards

String literal

A sequence of characters enclosed in double quotes.

41
New cards

Scanner object

An object used to read input from various sources, including keyboard input.

42
New cards

Instantiation

The process of creating an instance of a class.

43
New cards

Data type

A classification that specifies which type of value a variable can hold.

44
New cards

Double

A data type that can hold floating-point numbers with double precision.

45
New cards

Comment

A piece of text in the code that is ignored by the compiler.

46
New cards

Multiline comment

A comment that includes all text between an opening /* and a closing */.

47
New cards

Floating-point notation

A representation of a number that includes a decimal point.

48
New cards

Variable type

The specific kind of data that a variable can hold.

49
New cards

Variable assignment

The process of setting a variable to a specific value.

50
New cards

Variable name

The identifier used to reference a variable in code.

51
New cards

End-of-line comment

A comment that appears on the same line as a statement, typically used for brief explanations.

52
New cards

Run-time errors

Errors that occur when an illegal operation is attempted during program execution, such as dividing by zero.

53
New cards

Logic errors

Errors that occur when the program does not produce the expected outcome due to incorrect logic.

54
New cards

Purpose of comments

To make a program more readable and easier to maintain.

55
New cards

Variable declaration comments

Comments that explain the purpose of a variable when it is declared.

56
New cards

Major segment comments

Brief comments that explain the purpose of major segments of code.

57
New cards

Complex section comments

Comments that explain the workings of complex or tricky sections of code.

58
New cards

Self-documenting programs

Programs that are written in a way that their code structure and symbols convey meaning without needing excessive comments.

59
New cards

Over-commenting

Including too many comments in a program, which can become burdensome to maintain.

60
New cards

Under-commenting

Including too few comments in a program, making it difficult for others to understand.

61
New cards

Compiler error messages

Messages printed by the compiler when it detects a syntax error.

62
New cards

Cryptic error messages

Error messages that are difficult to understand, often encountered during compilation or execution.

63
New cards

Misleading comments

Comments that restate the obvious or do not add value to the understanding of the code.

64
New cards

Commenting best practices

Guidelines for writing effective comments that enhance code readability.

65
New cards

Code readability

The ease with which a programmer can read and understand code.

66
New cards

Maintaining comments

The process of updating comments to ensure they remain relevant and accurate as code changes.

67
New cards

Error types

The three types of errors in programming: syntax errors, run-time errors, and logic errors.

68
New cards

Compiler

A program that translates source code into byte code, detecting syntax errors in the process.

69
New cards

ArithmeticException

An exception thrown by the Java Virtual Machine (JVM) when an illegal arithmetic operation occurs, such as division by zero.

70
New cards

Case-Sensitivity

A characteristic of programming languages where identifiers are distinguished based on the use of uppercase and lowercase letters.

71
New cards

JVM

Java Virtual Machine, an engine that provides a runtime environment to drive Java applications.

72
New cards

Scanner

A class in Java used to obtain input of primitive types and strings from various sources, including user input.

73
New cards

Null Pointer Exception

An error that occurs when a message is sent to a variable that has not been instantiated.

74
New cards

No Such Method Error

A runtime error that occurs when a method is misspelled, such as 'Main' instead of 'main'.

75
New cards

Test Data

Data used to test a program to verify that it produces the expected output.

76
New cards

Infinity

A value that represents a number that falls outside the range of a double in Java.

77
New cards

Java Case Sensitivity

The property of Java that distinguishes between uppercase and lowercase letters, making 'Main' and 'main' different.

78
New cards

Arithmetic Error

An error that occurs during arithmetic operations, such as division by zero.

79
New cards

Desk Checking

The process of rereading code carefully after writing it to reduce logic errors.

80
New cards

Compile-time Error

An error that occurs when the code is compiled, preventing the program from running.

81
New cards

Debugging

The process of identifying and removing errors or bugs from a program.

82
New cards

Bug

A term used to refer to a logic error in a program.

83
New cards

Terminal Window

The interface where output from a program is displayed.

84
New cards

User Input

Data provided by the user that is processed by the program.

85
New cards

Debugging Statements

Code inserted into a program to help identify and locate errors during execution.

86
New cards

Scanner Class

A class in Java used to obtain input from the user.