141-150 Flashcards

1
Q

Is it possible to instantiate the abstract class?

A

No the abstract class can never be instantiated even if it contains a constructor and all of its methods are implemented

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

What is a String pool?

A

String pool is the space reserved in the heap memory that can be used to store strings. An advantage of using a string pool is that when we create a string literal the JVM checks the string constant pool first. If the string is already in the pool a reference to the pooled string is returned. If not a new string instance is created and placed in the pool.

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

What are advantages of Java inner classes?

A

Nested classes can access all the members of the outer class including private.
Nested classes are used to develop more readable and maintainable code as it groups the classes and interfaces in one place only

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

What is the difference between inner classes and nested classes?

A

Inner classes are non-static nested classes.

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

What is a stream?

A

A stream is a sequence of data that flows from source to destination. It is composed of bytes. We have 3 automatically created streams
System.out: Standard output stream
System.in: Standard input stream
System.err: Standard error stream

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

What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?

A

The R/W class hierarchy is character oriented where the I/O class is byte oriented.
The ByteStream classes are used to perform input-output of 8-bit bytes where the CharacterStream classes are used to perform the input/output for the 16-bit unicode system.

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

What are FilterStreams?

A

FilterStream classes are used to add additional functionalities to other stream classes. It acts like an interface which read the data from a stream, filters it, and pass the filtered data to the caller.
E.g. adding line numbers to a destination file

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

What is an I/O filter?

A

An I/O filter is an object that reads from one stream and writes to another usually altering the data in some was as it is passed from one stream to another.

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