Chapter 1 Flashcards

1
Q

Java is platform neutral. What does that mean?

A

It can run without modification on different computing environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

An approach to building computer programs that mimics how objects relate to each other in the real world is known as…

A

Object-oriented programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A template used to create an object is called a…

A

Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A self-contained element of a computer program that has certain attributes and can accomplish certain tasks is called an…

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In a class, attributes are defined using…

A

Variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Variables that define an attribute of a particular object are called…

A

Instance variables, or object variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Variables that have the same value in all objects of a class are called…

A

Class variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The behavior that a class is capable of is defined by …

A

Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Groups of related statements in a class that perform a specific task are called…

A

Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How many tasks does a well-defined method typically perform?

A

One

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the Java command for printing text and

moving to the next line?

A

System.out.println(“Text goes here”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The mechanism that enables one class to possess all the behavior and attributes of another class is called…

A

Inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A class that inherits from another class is called a…

A

Subclass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A class that passes its attributes and behavior to another class is called a

A

Superclass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

At the top of the Java class hierarchy is the class called _____________

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

If you create a new class that doesn’t indicate a superclass, Java assumes that the new class inherits directly from what superclass?

A

Object

17
Q

When you invoke the method of a particular object, how does Java go about attempting to find it in the object hierarchy?

A

Java looks for the method in the current object. If it doesn’t find it, it moves up the class hierarchy until it finds it.

18
Q

What does it mean to override a method?

A

Replacing the behavior defined in a method higher up the class hierarchy by creating a method that has the same name.

19
Q

How many superclasses can a Java class have?

A

One.

This differs from some other languages, such as C++, which can have multiple superclasses.

20
Q

A group of related classes and interfaces is called a ________________.

A

Package

21
Q

What is the name of the package in which the class “java.lang.Object” is found?

A

java.lang

22
Q

By default, objects in which Java package do NOT need to include a reference to the package?

A

java.lang

23
Q

What command is used to import a package so that the classes in those packages can be referenced without including their package names?

A

import

24
Q

When a Java class imports an entire package, does it increase the compiled size of that class?

A

No, the sole reason for using the import command is to eliminate the need to refer to the full package names in your code.

25
Q

When you create a subclass, what must you define about that class?

A

Anything that is different from its superclass.