9 Creating Instances of a Class

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

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:24 PM on 11/19/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

28 Terms

1
New cards

What is the purpose of the NEW operator in ABAP?

The NEW operator is used to dynamically create a new instance of a class in program memory.

2
New cards

What must you use to access instance attributes outside the class in ABAP?

You must use a reference variable followed by the instance component selector (->) and then the attribute name.

3
New cards

How do you declare a reference variable in ABAP?

You declare a reference variable using the DATA statement with the addition TYPE REF TO followed by the name of the class.

4
New cards

What does the term 'NULL reference' mean?

The initial state of a reference variable indicating it does not currently point to any object in memory.

5
New cards

What is an internal table in ABAP?

A dynamic data structure that can store multiple lines of data, often used to manage collections of records or object references.

6
New cards

What happens when you assign one reference variable to another?

The address of the object to which the first variable is pointing is copied into the second reference variable, making both reference the same object.

7
New cards

What is the function of the garbage collector in ABAP?

The garbage collector automatically reclaims memory by destroying objects to which no active reference variables point.

8
New cards

What is the difference between a static attribute and an instance attribute?

A static attribute belongs to the class itself and exists once for the entire class, while an instance attribute belongs to a specific instance of a class.

9
New cards

How do you address a static attribute outside a class?

By typing the class name, then the static component selector (=>), and finally the attribute name.

10
New cards

How is an object reference stored in an internal table?

An object reference is appended to the internal table, maintaining the reference to the created object.

11
New cards

What is indicated by the pound sign #( ) after the NEW operator?

It means to use the type of the variable before the equals sign, allowing for concise instantiation of a class.

12
New cards

What does the APPEND statement do in ABAP?

The APPEND statement is used to add an item to the end of an internal table.

13
New cards

How do you create multiple instances of a class using the same reference variable?

By using the NEW #( ) expression each time, which overwrites the previous instance address in the reference variable.

14
New cards

What syntax is used to access instance attributes after using a reference variable?

Use the instance component selector (->) followed by the instance attribute name.

15
New cards

What will happen if the last reference to an object is deleted?

The object becomes eligible for garbage collection and will be destroyed by the garbage collector.

16
New cards

What character is used as the instance component selector in ABAP?

The instance component selector is represented by an arrow (->) made of a dash and a greater-than sign.

17
New cards

What keyboard shortcut is used to activate a class in the ABAP editor?

Ctrl + F3 is used to activate a class in the ABAP editor.

18
New cards

What type of variable structure is used to hold object references for managing multiple instances?

An internal table is used to hold object references for managing multiple instances.

19
New cards

In ABAP, what does the DATA statement do?

The DATA statement is used to declare variables, including reference variables for classes.

20
New cards

What does the CLEAR statement do for reference variables?

The CLEAR statement resets reference variables to their initial value, which is NULL.

21
New cards

What is the significance of using different characters for static and instance component selectors in ABAP?

It simplifies distinguishing between accessing class-level data and instance-specific data.

22
New cards

How can you debug a program in Eclipse ADT?

You can use breakpoints to pause execution and examine variable values at specific points.

23
New cards

What purpose does the Pattern Matching (.matches) keyword serve in ABAP?

It allows checking patterns in strings and evaluating if a string meets specific conditions.

24
New cards

What tool allows you to visualize the state of variables during program execution?

The Variables View in the Eclipse ADT debugger displays the current values of variables.

25
New cards

What action should be taken to check if an object reference is still valid before using it?

Check if the reference variable is not NULL before using it to prevent errors.

26
New cards

What is a reference variable primarily used for in ABAP object-oriented programming?

A reference variable is used to create, address, and manage an object within memory.

27
New cards

Explain how the Eclipse toolbar enhances developer productivity in ABAP programming.

The Eclipse toolbar provides quick access to navigation and development functionalities, improving coding efficiency.

28
New cards

When is the class definition loaded into program memory?

The class definition is loaded when it is first accessed, such as when creating an instance.

Explore top flashcards