1/48
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What are the main features of Java?
Java is platform-independent, object-oriented, secure, robust, and multithreaded.
What is the purpose of the Java Development Kit (JDK)?
The JDK is a software development kit that provides tools for developing and executing Java applications.
What is the Java Runtime Environment (JRE)?
The JRE provides the libraries and components necessary to run Java applications.
What is a real-world application of Java?
Java is used in web applications, mobile applications, desktop applications, and enterprise-level solutions.
What does object-oriented programming (OOP) entail?
OOP involves concepts like encapsulation, inheritance, polymorphism, and abstraction.
What are the basic components of a Java program?
A Java program typically includes a class definition, a main method, and executable statements.
How do you compile and execute a Java program?
You compile a Java program using 'javac' command and execute it using 'java' command followed by the class name.
What conventions should be followed in a Java program?
Use camelCase for variable and method names, and PascalCase for class names.
What are Java reserved words?
Reserved words are predefined keywords in Java that cannot be used as identifiers, such as 'class', 'public', 'static', etc.
How do you use comments in Java?
Single-line comments use '//' and multi-line comments use '/* */'.
What does the java.lang package contain?
The java.lang package contains fundamental classes such as String, Math, and System.
How do you declare and initialize a variable in Java?
Declare a variable with a type followed by its name, and assign it a value, e.g., 'int x = 5;'.
What is final in Java?
The 'final' keyword indicates that a variable's value cannot be changed once it is initialized.
What are the basic arithmetic operators in Java?
The basic arithmetic operators are + (addition), - (subtraction), * (multiplication), / (division), and % (modulus).
What is the purpose of the increment and decrement operators?
They are used to increase or decrease a variable's value by one.
What is the difference between == for primitives and objects?
For primitives, == compares values, while for objects, it compares the references.
How do you declare a String variable?
A String variable can be declared as 'String name = "example";'.
What is an ArrayList in Java?
An ArrayList is a resizable array that can store objects and allows dynamic data manipulation.
What method would you use to handle exceptions in Java?
Use try and catch blocks to handle exceptions.
What are the looping statements in Java?
The looping statements include for, while, and do-while loops.
What is a constructor in Java?
A constructor is a special method used to initialize objects when they are created.
What is a static method in Java?
A static method belongs to the class rather than any object instance and can be called without creating an instance.
What are accessor and mutator methods?
Accessor methods retrieve values of instance variables, while mutator methods modify them.
What is the purpose of the switch statement?
The switch statement executes code based on the value of a variable matching specified cases.
What is inheritance in Java?
Inheritance is a mechanism where one class can inherit properties and methods from another class.
What is polymorphism in Java?
Polymorphism allows methods to do different things based on the object it is acting upon.
What is encapsulation in Java?
Encapsulation is the concept of wrapping data (variables) and methods into a single unit (class) and restricting access to some components.
What is abstraction in Java?
Abstraction is the concept of hiding complex implementation details and showing only the essential features of an object.
What is the difference between an interface and an abstract class?
An interface is a contract that classes must follow, while an abstract class can provide some implementation and state.
What are Java annotations?
Annotations provide metadata about the Java code and can be used for various purposes such as defining behaviors, configurations, and documentation.
What is the significance of the main method in Java?
The main method is the entry point for any Java application and is where program execution begins.
What is the purpose of the 'synchronized' keyword in Java?
The 'synchronized' keyword is used to control access to a block of code or method by multiple threads, ensuring thread safety.
What is a Java package?
A package is a namespace that groups related classes and interfaces, helping to organize code.
What is the purpose of the 'this' keyword in Java?
The 'this' keyword refers to the current instance of a class, used to distinguish between class attributes and parameters.
What are exception types in Java?
Exception types include checked exceptions (compile-time) and unchecked exceptions (runtime errors).
What is method overloading in Java?
Method overloading allows multiple methods to have the same name with different parameters.
What is the Java Collections Framework?
The Java Collections Framework provides a set of classes and interfaces for storing and manipulating groups of data.
What is a thread in Java?
A thread is a lightweight process that can run concurrently with other threads, allowing multitasking.
What is the role of the garbage collector in Java?
The garbage collector automatically manages memory by reclaiming memory occupied by objects that are no longer in use.
What is the use of the 'super' keyword in Java?
The 'super' keyword is used to access methods and constructors of a superclass in a subclass.
What are instance variables in Java?
Instance variables are non-static variables defined in a class and represent the state of an object.
What is method overriding in Java?
Method overriding allows a subclass to provide a specific implementation of a method that is already defined in its superclass.
What is the role of the 'static' keyword in variable declaration?
The 'static' keyword indicates that the variable belongs to the class rather than instances of the class.
How do you create a multi-dimensional array in Java?
A multi-dimensional array is created by defining the array type followed by multiple brackets, e.g., 'int[][] matrix = new int[3][3];'.
What is a Java interface?
A Java interface is a reference type that can contain only constants, method signatures, default methods, static methods, and nested types.
What are the different types of loops available in Java?
Java provides for, while, and do-while loops for iteration over a sequence or collection.
What is the Java Naming Convention?
Java Naming Convention refers to standard practices for naming classes, methods, and variables to improve code readability.
What is a final class in Java?
A final class cannot be subclassed, meaning no class can extend it.
What is the purpose of the Java 'Cloneable' interface?
The Cloneable interface indicates that a class allows a field-by-field copy of its objects.