Module 2 - Java Semantics and Syntax

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

1/72

flashcard set

Earn XP

Description and Tags

Flashcards covering fundamental Java concepts, data types, operators, and control flow statements like if, if-else, and else-if, extracted from lecture notes.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

73 Terms

1
New cards

Object-Oriented Programming (OOP)

A programming paradigm that focuses on robust, modular, and reusable code through encapsulation, inheritance, polymorphism, and abstraction - is essential in modern software development.

2
New cards

Dynamic Language

A type of programming language, like Python, often characterized by a sparse, clear syntax, consistent object model, and being typically 'informal' in its structure and type handling.

3
New cards

Industrial Strength Languages

Programming languages such as Java, Rust, C++, C#, and Ada, which are typically more formal, offer better performance, and are designed for large-scale projects with multiple developers, emphasizing maintainability and strictness.

4
New cards

Java Standard Library

A comprehensive collection of predefined classes (over 4,000 in Java 14 Standard Edition) that enables the creation of sophisticated Java programs without extensive external dependencies.

5
New cards

Automatic Garbage Collection

A feature in Java that automatically manages and deallocates memory that is no longer in use.

6
New cards

Main Method

The designated entry point for the execution of an executable Java program, defined as public static void main(String[] args).

7
New cards

System.out.println();

A Java command used to display text output to the console, followed by a new line.

8
New cards

String Literal

A sequence of characters enclosed in double quotes (e.g., "Hello World!") used to represent fixed text in Java.

9
New cards

Curly Braces ({})

Used in Java to delimit blocks of code, such as class definitions, method definitions, or statements within conditional and loop structures.

10
New cards

Semicolon (;)

A required punctuation mark in Java that signifies the end of a statement, similar to a period in English.

11
New cards

System.out.print();

A Java command used to display text output to the console without advancing to a new line.

12
New cards

System.out.printf();

A Java method used to format and display text output to the console, allowing for specified formatting of variables within the output.

13
New cards

Compiler

A software tool that translates Java source code files (.java) into machine-readable bytecode files (.class), detecting syntax errors in the process.

14
New cards

Syntax Errors

Errors in Java code that violate the language's grammatical rules, detected by the compiler during the compilation phase, such as missing semicolons or unmatched braces.

15
New cards

Bug

An informal term for an error or flaw in computer code that causes unexpected behavior or prevents a program from running correctly.

16
New cards

Debugging

The systematic process of identifying, analyzing, and removing errors (bugs) from a computer program.

17
New cards

Compile Time Error

An error identified and reported by the compiler during the process of converting source code into bytecode, often due to incorrect syntax.

18
New cards

Single-line Comment

In Java, explanatory text marked by // that extends to the end of the line, ignored by the compiler.

19
New cards

Multi-line Comment

In Java, explanatory text enclosed between /* and */ that can span multiple lines, ignored by the compiler.

20
New cards

Interpreted Language

A programming language, such as Python, where program instructions are executed directly by an interpreter without a separate prior compilation step.

21
New cards

javac

The Java compiler command-line tool used to convert Java source code (.java files) into Java bytecode (.class files).

22
New cards

Bytecode (.class file)

The platform-independent intermediate code generated by the Java compiler from source code, which is then executed by the Java Virtual Machine (JVM).

23
New cards

java (command)

The command-line tool used to launch and execute Java applications by running compiled bytecode through the Java Virtual Machine.

24
New cards

Java Virtual Machine (JVM)

An abstract computing machine that enables a computer to run Java programs by interpreting Java bytecode, providing a runtime environment.

25
New cards

Code Block

A group of zero or more statements in Java enclosed within a pair of curly braces {}.

26
New cards

public (keyword)

A Java access modifier that signifies a class, method, or variable is accessible from any other class.

27
New cards

static (keyword)

A Java keyword indicating that a member (method or variable) belongs to the class itself, rather than to any specific instance of the class.

28
New cards

void (keyword)

A Java keyword used in method declarations to indicate that the method does not return any value.

29
New cards

String[] args

The parameter list of the main method, representing an array of String objects that can be used to pass command-line arguments to the Java program.

30
New cards

System.out

The standard output stream object in Java, used for displaying information to the console.

31
New cards

Dot Notation

A syntax used in Java (and other languages) to access members (fields or methods) of an object or class (e.g., object.method(), Class.field).

32
New cards

Whitespace (Java)

Characters like spaces, tabs, and newlines that are generally ignored by the Java compiler, unlike in some other languages (e.g., Python) where they can be syntactically meaningful.

33
New cards

Variable

A named storage location in a computer's memory that holds a value, which can change or vary during program execution.

34
New cards

Primitive Variables

Variables in Java that directly store fundamental data types like int, double, and boolean, holding the actual value in memory.

35
New cards

Object/Reference Variables

Variables in Java that store a 'reference' (memory address) to an object, rather than the object's value itself.

36
New cards

int (data type)

A primitive data type in Java used to store 32-bit signed integer values (whole numbers).

37
New cards

double (data type)

A primitive data type in Java used to store 64-bit double-precision floating-point numbers (decimal numbers).

38
New cards

boolean (data type)

A primitive data type in Java used to store logical values, which can only be true or false.

39
New cards

char (data type)

A primitive data type in Java used to store a single 16-bit Unicode character, enclosed in single quotes (e.g., 'A', '7').

40
New cards

byte (data type)

A primitive data type in Java used to store 8-bit signed integer values, with a range from -128 to 127, useful for memory efficiency.

41
New cards

short (data type)

A primitive data type in Java used to store 16-bit signed integer values, with a range from -32,768 to 32,767.

42
New cards

long (data type)

A primitive data type in Java used to store 64-bit signed integer values, for numbers exceeding the range of int (literals typically suffixed with 'L').

43
New cards

float (data type)

A primitive data type in Java used to store 32-bit single-precision floating-point numbers, less precise than double (literals typically suffixed with 'F').

44
New cards

String (data type)

A non-primitive (object) data type in Java representing a sequence of characters, used for text, and enclosed in double quotes.

45
New cards

Type (data type)

In programming, a classification that defines a set of values (its domain) and the operations that can be performed on those values.

46
New cards

Declaring a Variable

The process of creating a variable in Java by specifying its data type and a unique name, which reserves memory for it.

47
New cards

Bits (Binary Digits)

The smallest unit of information in computing, capable of representing two values, typically 0 or 1.

48
New cards

String Concatenation Operator (+)

The operator used in Java to join two or more strings together, or to combine strings with other data types for output.

49
New cards

Java Keywords/Reserved Words

Words that have predefined meanings in the Java language and cannot be used as identifiers (variable names, class names, etc.).

50
New cards

Case-Sensitive

A characteristic of Java where uppercase and lowercase letters are treated as distinct; for example, myVariable and MyVariable are considered different identifiers.

51
New cards

Assignment Statement

A programming statement that stores the value of an expression on the right-hand side into the variable specified on the left-hand side.

52
New cards

Assignment Operator (=)

The operator in Java used to assign a value to a variable (e.g., score = 10;).

53
New cards

Variable Increment

The operation of increasing a variable's current value, typically by a specific amount like one (e.g., score = score + 1;).

54
New cards

Scanner class

A utility class in Java that allows programs to read various types of input (e.g., numbers, strings) from the keyboard or other input sources.

55
New cards

scan.nextLine()

A method of the Scanner class used to read an entire line of text input from the console until a newline character is encountered.

56
New cards

Arithmetic Operators

Standard mathematical operators in Java, including + (addition), - (subtraction), * (multiplication), / (division), and % (modulo/remainder).

57
New cards

Integer Division

An arithmetic operation in Java where dividing two int values results in an int value, truncating (dropping) any fractional part of the result.

58
New cards

Division by Zero

An illegal operation in integer arithmetic in Java that throws an ArithmeticException because the result is undefined.

59
New cards

== (Equality Operator)

A relational operator in Java used to test if two values are equal, returning a true or false boolean result.

60
New cards

!= (Not Equal Operator)

A relational operator in Java used to test if two values are not equal, returning a true or false boolean result.

61
New cards

Operator Precedence

Rules that determine the order in which operators in an expression are evaluated; for example, multiplication, division, and modulo generally occur before addition and subtraction.

62
New cards

Modulo Operator (%)

An arithmetic operator in Java that returns the remainder of a division operation (e.g., 10 % 3 results in 1).

63
New cards

Boolean Expression

An expression that evaluates to a boolean value, which can only be true or false.

64
New cards

Relational Operators

Operators in Java (<, >, <=, >=, ==, !=) used to compare two numeric values or expressions, resulting in a boolean true or false value.

65
New cards

compareTo() and equals() (String methods)

Methods used in Java for comparing String objects, as relational operators like == are not typically used for meaningful string value comparison.

66
New cards

if Statement (Conditional/Selection)

A control flow statement in Java that executes a block of code only if its specified boolean condition evaluates to true.

67
New cards

Flow of Control

The order in which statements in a program are executed. Conditional statements, loops, and method calls can alter this sequential flow.

68
New cards

if-else Statement

A two-way conditional statement in Java that executes one block of code if its boolean condition is true and a different block if the condition is false.

69
New cards

if-else-if Statement (Multi-way conditional)

A control flow construct in Java that handles multiple conditions sequentially, executing the block of code associated with the first true condition encountered.

70
New cards

Logical OR (||)

A logical operator in Java that returns true if at least one (one, or the other, or both) of its boolean operands is true (inclusive OR).

71
New cards

Logical NOT (!)

A logical operator in Java that inverts the boolean value of its operand; true becomes false, and false becomes true.

72
New cards

Inclusive-OR

Describes the behavior of the logical OR operator (||) where the combined expression is true if the first condition is true, or the second condition is true, or both conditions are true.

73
New cards

Short-Circuit Evaluation

A feature of the && (AND) and || (OR) logical operators in Java where the right-hand operand is not evaluated if the overall result can be determined solely by the left-hand operand.