Java Flashcards
Why is the Java platform independent?
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.
What class is the superclass for every other class?
Object class.
Why is Java not considered to be 100% object orientated?
Because it make use of eight primitive data types (boolean, byte, char, int, float, double, long, short) which are not objects.
What does a constructor do in Java?
It is a block of code used to initialise an object. The keyword new class the constuctor.
What is a singleton class?
Only one instance of a singleton class can be created at any given time. This is achieved by making the constructor private.
What is a static method?
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.
What the four pillars of object orientation
Abstraction, Encapsulation, Inheritance, Polymorphism