chapter 1 Flashcards
(26 cards)
What is Java?
Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible.
True or False: Java is platform-dependent.
False: Java is platform-independent due to the Java Virtual Machine (JVM).
What does JVM stand for?
Java Virtual Machine
Fill in the blank: Java uses a __________ to manage memory.
Garbage Collector
Which of the following is a primitive data type in Java? A) String B) int C) Array
B) int
What keyword is used to create a class in Java?
class
True or False: In Java, method overloading is allowed.
True
What is the default value of a boolean variable in Java?
false
Which of the following keywords is used to inherit a class in Java? A) implements B) extends C) inherits
B) extends
What is the main method signature in a Java application?
public static void main(String[] args)
Fill in the blank: The __________ keyword is used to handle exceptions in Java.
try
What is an interface in Java?
An interface is a reference type in Java that is similar to a class and is a collection of abstract methods.
True or False: Java supports multiple inheritance through classes.
False: Java does not support multiple inheritance through classes but allows it through interfaces.
What is the purpose of the ‘final’ keyword in Java?
The ‘final’ keyword is used to declare constants, prevent method overriding, and inheritance.
Which of the following is NOT a feature of Java? A) Automatic garbage collection B) Platform independence C) Pointers
C) Pointers
What is the use of the ‘static’ keyword in Java?
‘static’ indicates that a member belongs to the class rather than instances of the class.
Fill in the blank: In Java, a __________ is a blueprint from which individual objects are created.
class
What does the ‘this’ keyword refer to in Java?
The ‘this’ keyword refers to the current object instance.
True or False: In Java, all classes are subclasses of the Object class.
True
What is the purpose of the ‘synchronized’ keyword in Java?
‘synchronized’ is used to control access to a block of code or an object by multiple threads.
What is a constructor in Java?
A constructor is a special method used to initialize objects.
Which of the following collections does not allow duplicate elements? A) List B) Set C) Map
B) Set
What is the difference between ‘== ‘ and ‘equals()’ in Java?
’==’ checks for reference equality while ‘equals()’ checks for value equality.
What is polymorphism in Java?
Polymorphism allows methods to do different things based on the object it is acting upon.