COS202 Computer Programming II Lecture Notes

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/39

flashcard set

Earn XP

Description and Tags

Flashcards covering core Java concepts, OOP principles, syntax, data types, control structures, and exception handling based on the COS202 course transcript.

40 Terms

1
New cards

Object Oriented Programming (OOP)

A programming paradigm based upon objects having both data and methods that aims to incorporate the advantages of modularity and reusability.

2
New cards

Procedure Oriented Programming (POP)

A programming approach where the problem is considered as a sequence of tasks to be done, written as a set of functions with primary focus on functions rather than data.

3
New cards

James Gosling

One of the individuals at Sun Microsystems, Inc. who conceived the Java programming language in 19911991.

4
New cards

Package

The Java language's namespace mechanism used to group similar types of classes, interfaces, and subpackages.

5
New cards

Java Development Kit (JDK)

The software environment used to develop Java applications, which must be downloaded according to the user's operating system.

6
New cards

.java

The disk file extension used for storing programs written in a text editor or Integrated Development Environment (IDE).

7
New cards

Java Virtual Machine (JVM)

The Java interpreter that converts bytecodes (.class.class files) into the machine language of the particular computer.

8
New cards

Identifier

A series of characters consisting of letters, digits, underscores (_), and dollar signs ($\text{\textdollar}) that cannot begin with a digit or contain spaces.

9
New cards

Keywords

Reserved words in Java, such as abstract\text{abstract}, class\text{class}, and public\text{public}, which are always spelled with lowercase letters and cannot be used as identifiers.

10
New cards

Javadoc Comments

Special comments starting with /∗∗/^{**} and ending with ∗/^{*/} used for generating HTML documentation for Java programs.

11
New cards

Byte

A primitive data type consisting of an 88-bit signed two's complement integer.

12
New cards

Int

A primitive data type consisting of a 3232-bit signed two's complement integer.

13
New cards

Boolean

A primitive data type representing 11 bit of information.

14
New cards

Char

A primitive data type consisting of a single 1616-bit Unicode character.

15
New cards

Local Variables

Variables declared in methods, constructors, or blocks that are created when the block is entered and destroyed once it is exited.

16
New cards

Instance Variables

Variables declared in a class but outside methods; they are created when an object is created with new\text{new} and destroyed when the object is destroyed.

17
New cards

Class Variables

Also known as static variables, these are declared with the static\text{static} keyword; only one copy exists per class regardless of the number of objects created.

18
New cards

Conditional Operator (?:)

Also known as the ternary operator, it consists of three operands and is used to evaluate Boolean expressions to decide which value to assign to a variable.

19
New cards

instanceof Operator

An operator used only for object reference variables to check whether an object is of a particular class or interface type.

20
New cards

Sequential Execution

The process where statements in a program are executed one after the other in the order in which they are written.

21
New cards

Transfer of Control

A process enabled by various Java statements where the next statement to execute is not the next one in sequence.

22
New cards

Switch Statement

A multiple-selection statement that performs one of many different actions depending on the value of an expression.

23
New cards

Enhanced for Statement

A repetition statement that iterates through the elements of an array without using a counter.

24
New cards

Encapsulation

The technique of making fields in a class private and providing access via public methods, also referred to as data hiding.

25
New cards

Data Abstraction

The ability to declare a class as abstract, meaning it cannot be instantiated and serves as a superclass for other classes.

26
New cards

Polymorphism

The ability of an object to take on many forms, typically occurring when a parent class reference is used to refer to a child class object.

27
New cards

Method Overloading

When a class has two or more methods with the same name but different parameters.

28
New cards

Inheritance

The process where one object acquires all the properties and behaviors of a parent object, represented by the IS-A relationship.

29
New cards

Aggregation

A HAS-A relationship where a class contains an entity reference to another class.

30
New cards

Interface

A blueprint of a class containing static constants and abstract methods used to achieve full abstraction and multiple inheritance.

31
New cards

Marker Interface

An interface that has no members, such as Serializable\text{Serializable} or Cloneable\text{Cloneable}, used to provide essential information to the JVM.

32
New cards

Exception

An indication of a problem that occurs during a program’s execution, allowing applications to resolve problems and continue executing or terminate gracefully.

33
New cards

Stack Trace

Information displayed when an exception occurs, including the exception name, a descriptive message, and the method-call stack at the time of the error.

34
New cards

Checked Exception

Exceptions that are checked at compile-time by the Java compiler, such as IOException\text{IOException} and SQLException\text{SQLException}.

35
New cards

Unchecked Exception

Exceptions that extend RuntimeException\text{RuntimeException} and are checked at runtime, such as ArithmeticException\text{ArithmeticException} and NullPointerException\text{NullPointerException}.

36
New cards

finally Block

An optional block that follows try or catch blocks and always executes whether or not an exception is thrown, typically containing resource-release code.

37
New cards

throw Keyword

A keyword used to explicitly throw an exception, mainly used to throw custom exceptions.

38
New cards

throws Keyword

A keyword used in a method signature to declare the types of exceptions a method might throw.

39
New cards

Array

A sequence of variables containing values of the same type, considered as objects and reference types in Java.

40
New cards

JOptionPane

A class in the javax.swing\text{javax.swing} package used to pop up standard dialog boxes for user input or information.