Chapter 4 Flashcards

1
Q

What is use of constructor

A

For object initialization

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

What are access modifiers

A
Public (accessible from everywhere)
Private (accessible within a class)
Protected (accessible class and sub classes)
Package access (by default : accessible within current directory)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is setter

A

It is a function that assign value to any variable. It helps in validation.

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

What about constructors

A

Constructors are public and they do not have any return type.

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

Does we define destructor in Java

A

No

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

What is the only way in Java to make object

A

new operator

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

Do we use -> operator in java

A

No

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

What are static variable

A

It is such variable which does not belong to object, but it belongs to class. Unlike instance variable belongs to object.

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

Does non-static member can be called from static

A

No

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

Is memory management in java automatic

A

Yes

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

Does java use garbage collection and what is its role

A

Yes. Garbage collection is for memory management

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

What is command of garbage collection

A

system.gc

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

What finalize do

A

It do works as we do in destructor

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

Which is the main class of java and by which every class is inherited

A

Object class

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

What toString method do

A

It converts any object state into string and return

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