Books
Learn HTML
Learn CSS
Learn Git
Learn Javascript
Learn PHP
Learn python
Learn Java
Exercises
HTML
JavaScript
Git
CSS
PHP
Courses
Quizzes
Snippets
Tools
General Tools
Password Generator
HTML Editor
HTML Encoder
Base 64
Code Diff
JSON Beautifier
CSS Beautifier
Markdown Convertor
Find the Closest Tailwind CSS Color
Phrase encrypt / decrypt
Browser Feature Detection
Number convertor
CSS Maker
CSS Maker
CSS Maker text shadow
CSS Maker Text Rotation
CSS Maker Out Line
CSS Maker RGB Shadow
CSS Maker Transform
CSS Maker Font Face
Color Tools
Color Picker
Colors CMYK
Colors HWB
Colors HSL
Color Hex
Color mixer
Color Converter
Colors RGB
Color Contrast Analyzer
Color Gradient
String Tools
String Length Calculator
MD5 Hash Generator
Sha256 Hash Generator
String Reverse
URL Encoder
URL Decoder
Base 64 Encoder
Base 64 Decoder
Extra Spaces Remover
String to Lowercase
String to Uppercase
Word Count Calculator
Empty Lines Remover
HTML Tags Remover
Binary to Hex
Hex to Binary
Rot13 Transform on a String
String to Binary
Duplicate Lines Remover
Change theme
Dark
Light
System
Books
Learn HTML
Learn CSS
Learn Git
Learn Javascript
Learn PHP
Learn python
Learn Java
How To
How To NodeJs
How To Linux
How To AngularJs
How To PHP
How To HTML
How To CSS
How To Symfony
How To Git
How To Apache
How To JavaScript
How To Java
How To Vue.js
How To Python
Java Basics
1/25
What is the purpose of the 'finalize' method in Java?
To initialize variables
To clean up resources before an object is garbage collected
To finalize a class definition
To finalize variable assignments
Next >
2/25
Which collection class in Java is synchronized?
ArrayList
LinkedList
Vector
HashSet
Next >
3/25
Which of these is not a valid Java access modifier?
public
protected
private
friend
Next >
4/25
What is the default value of a static variable in Java?
0 or null, depending on the type
1
undefined
It does not have a default value
Next >
5/25
What is the purpose of the 'this' keyword in Java?
To refer to the current class instance variable
To create a new instance of a class
To terminate the current method
To invoke a method of the superclass
Next >
6/25
What is the return type of the hashCode() method in Java?
Object
long
int
String
Next >
7/25
In Java, which of the following is a valid way to declare an array?
int array[5];
int[] array = new int[5];
array = new int[5];
int array[] = new int[5];
Next >
8/25
What is the default size of a 'HashSet' in Java?
16
10
12
32
Next >
9/25
Which method must be implemented in a class that implements the java.util.Comparator interface?
compare()
compareTo()
equals()
hashCode()
Next >
10/25
In Java, what is the purpose of the Collections.sort() method?
To sort elements of a collection in descending order
To randomly shuffle elements of a collection
To sort elements of a collection in ascending order
To reverse the order of elements in a collection
Next >
11/25
What is a 'daemon' thread in Java?
A high-priority thread
A thread that runs in the background
A thread that can't be killed
The main thread of an application
Next >
12/25
Which of the following is a checked exception in Java?
NullPointerException
ArrayIndexOutOfBoundsException
IOException
RuntimeException
Next >
13/25
What is the function of the 'native' keyword in Java?
It indicates that the method is implemented in another language like C or C++
It declares a method as part of the native Java library
It optimizes the method for faster execution
It makes the method accessible only within its own package
Next >
14/25
Which Java feature allows runtime binding of method calls?
Static Typing
Dynamic Binding
Method Overloading
Method Overriding
Next >
15/25
What is the primary difference between 'StringBuffer' and 'StringBuilder' in Java?
StringBuffer is mutable, while StringBuilder is immutable
StringBuilder is faster as it is not synchronized
StringBuffer can store characters, while StringBuilder cannot
StringBuilder is thread-safe, while StringBuffer is not
Next >
16/25
In Java, which method you must override to use an object as a key in a HashMap?
hashKey()
mapKey()
equals() and hashCode()
getKey()
Next >
17/25
What is 'garbage collection' in Java?
A process of deallocating memory by manually deleting objects
A process of automatically freeing memory occupied by objects that are no longer in use
A tool for optimizing Java code
A method for storing unused objects
Next >
18/25
What is the difference between 'static' and 'non-static' methods in Java?
Static methods can be called without creating an instance of the class
Non-static methods are always synchronized
Static methods are faster
Non-static methods can access any class variable
Next >
19/25
In Java, what is a 'checked' exception?
An exception that is checked at compile-time
An exception that is checked at runtime only
Any exception that occurs during program execution
An exception that cannot be caught or handled
Next >
20/25
What does the 'final' keyword indicate when applied to a method in Java?
The method can be overridden in a subclass
The method cannot be overridden in a subclass
The method will return a final value
The method will be executed at the end of the program
Next >
21/25
How can you achieve thread safety in Java?
By using synchronized blocks or methods
By avoiding the use of multiple threads
By using the 'volatile' keyword
By making all methods and variables private
Next >
22/25
What is 'encapsulation' in Java?
The technique of wrapping code and data together into a single unit
A process of linking a method with an object
A method of improving code execution time
The division of a program into smaller parts
Next >
23/25
What is 'polymorphism' in the context of Java?
The ability of a variable to hold objects of different types
The ability of Java to run on different platforms without modification
The ability of a method to perform different tasks based on the object
Changing the behavior of an object at runtime
Next >
24/25
How is a 'static inner class' different from a 'non-static inner class' in Java?
Static inner class can access static members of the outer class only
Non-static inner class cannot access any members of the outer class
Static inner class requires an instance of the outer class to exist
Non-static inner class can exist independently of the outer class
Next >
25/25
In Java, which method would you use to compare two String objects for content equality?
compareTo()
equals()
match()
equalContent()
Next >
To get the result of the quiz, please provide your email address (optional)..
Get Certificate
It seems you haven't answered any questions yet. Please provide your answers to proceed.