Unit 1 Flashcards
(93 cards)
What is Java?
Java is a high-level, object-oriented programming language designed to have as few implementation dependencies as possible.
True or False: Java is platform-independent.
True
What does JVM stand for?
Java Virtual Machine
Fill in the blank: Java uses __________ for memory management.
Garbage Collection
Which of the following is a feature of Java? a) Platform Independence b) Automatic Memory Management c) Object-Oriented d) All of the above
d) All of the above
What is the primary purpose of the Java Development Kit (JDK)?
The JDK provides tools for developing Java applications, including the Java compiler.
True or False: Java supports multiple inheritance.
False
What is the main use of the Java Runtime Environment (JRE)?
The JRE provides the libraries and the Java Virtual Machine necessary to run Java applications.
What keyword is used to define a class in Java?
class
Define encapsulation in Java.
Encapsulation is the mechanism of wrapping the data (variables) and code (methods) together as a single unit.
Which of the following is NOT a primitive data type in Java? a) int b) String c) boolean d) char
b) String
What does the ‘static’ keyword signify in Java?
The ‘static’ keyword indicates that a method or variable belongs to the class rather than instances of the class.
True or False: Java is a compiled language.
True
What is the purpose of the ‘main’ method in Java?
The ‘main’ method serves as the entry point for any Java application.
Fill in the blank: In Java, __________ is used to handle exceptions.
try-catch
What is a Java interface?
A Java interface is a reference type, similar to a class, that can contain only constants, method signatures, default methods, static methods, and nested types.
Which of the following is a Java collection framework? a) ArrayList b) HashMap c) TreeSet d) All of the above
d) All of the above
What is polymorphism in Java?
Polymorphism is the ability of a method to do different things based on the object it is acting upon.
True or False: Java supports operator overloading.
False
What is the default value of a boolean variable in Java?
false
What does ‘this’ keyword refer to in a Java class?
‘this’ refers to the current instance of the class.
What is the significance of the ‘final’ keyword in Java?
‘final’ indicates that a variable’s value cannot be changed, a method cannot be overridden, or a class cannot be subclassed.
Fill in the blank: The __________ statement is used to terminate a loop in Java.
break
What is the purpose of the ‘abstract’ keyword in Java?
‘abstract’ is used to declare a class that cannot be instantiated or a method that must be implemented by subclasses.