CSC1016S Theory - Classes Structure and Concepts

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

1/13

flashcard set

Earn XP

Description and Tags

Covers the generals of Java classes and their structural components, terms and core concepts as an OOP language.

14 Terms

1
New cards

Can a java file have more than one class?

Yes

2
New cards

Can a java file have more than one public class?

No

3
New cards

Must a java file have a public class(es)?

No

4
New cards

What does it mean for a class to be public?

It is accessible/visible to classes outside of the stored package/directory.

5
New cards

If a class is not specified to be public, what is it?

It has package-private access, meaning it is only accessible to java files within the same package.

6
New cards

How many non-public classes can a java file have?

A java file can have any number of non-public classes.

7
New cards

What are the two types of class interaction techniques and the names of their components?

Inheritance - comprised of a parent and child class(es).

Use of interface - comprised of an interface and concrete class(es).

8
New cards

Both inheritance and the use of an interface form what core principle of Java as an OOP language?

Polymorphism

9
New cards

When a class is defined as the child class of a parent, what action is the child class performing in relation to the parent class?

The child class is “extending” the parent class.

10
New cards

What does it mean for a child class to inherit from a parent and what is their relationship during object creation?

The child class carries both the methods and data fields of the parent class.


When an object of the child class is created it is an instance of both the child and parent class, but when an object of the parent class is created it is only an instance of the parent class.

11
New cards

What are the fields within an interface?

All of the fields within an interface are abstract method declarations.

12
New cards

What does it mean for a method to be abstract?

fcghcfgndtr

13
New cards

What is the action that a concrete class performs in relation to the interface it uses?

The concrete class is said to “implement” the interface.

14
New cards

What does it mean for a concrete class to implement an interface?

The concrete class must contain definitions of methods that match every abstract method declaration within the interface. There cannot be a declaration in the interface that is not defined in the concrete class, lest the compiler raise an error.