Java Flashcards

1
Q

Why is the Java platform independent?

A

Java is called so because of its bytecode which can run on any system irrespective of its underlying operation system. The JVM provides a run-time environment in which java byte can be executed.

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

What class is the superclass for every other class?

A

Object class.

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

Why is Java not considered to be 100% object orientated?

A

Because it make use of eight primitive data types (boolean, byte, char, int, float, double, long, short) which are not objects.

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

What does a constructor do in Java?

A

It is a block of code used to initialise an object. The keyword new class the constuctor.

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

What is a singleton class?

A

Only one instance of a singleton class can be created at any given time. This is achieved by making the constructor private.

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

What is a static method?

A

A static method belongs to the class rather than an object class. A static method can be invoked without the need for creating an instance of a class.

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

What the four pillars of object orientation

A

Abstraction, Encapsulation, Inheritance, Polymorphism

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