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
JTW Decoder
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 of these is not a valid Java access modifier?
public
protected
private
friend
Next >
3/25
Which Java feature allows the method of a subclass to override the method of its superclass?
Inheritance
Encapsulation
Polymorphism
Abstraction
Next >
4/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 >
5/25
Which exception is thrown when trying to access an element with a key that does not exist in a HashMap?
NullPointerException
ArrayIndexOutOfBoundsException
KeyNotFoundException
NoSuchElementException
Next >
6/25
Which of these data types is used to represent a single character in Java?
String
char
Character
byte
Next >
7/25
How do you handle exceptions in Java?
Using try-catch blocks
By using the 'throws' keyword
By using the 'extends' keyword
By declaring them as static
Next >
8/25
What is the function of the 'extends' keyword in Java?
To inherit methods from an interface
To extend a method's functionality
To inherit properties and methods from a superclass
To extend the memory allocation for an object
Next >
9/25
Which of these is an immutable class in Java?
java.lang.StringBuilder
java.lang.String
java.lang.StringBuffer
java.util.ArrayList
Next >
10/25
In Java, what is the difference between '==' and 'equals()'?
'==' checks for value equality, 'equals()' checks for reference equality
'==' checks for reference equality, 'equals()' checks for value equality
There is no difference
'equals()' is used only for strings
Next >
11/25
Which method must be implemented in a class that implements the java.util.Comparator interface?
compare()
compareTo()
equals()
hashCode()
Next >
12/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 >
13/25
What is the role of the 'break' statement in a loop in Java?
To skip the current iteration of the loop
To pause the loop execution temporarily
To terminate the loop immediately
To continue loop execution indefinitely
Next >
14/25
What is the concept of 'overloading' in Java?
Assigning extra resources to a Java application
Creating multiple methods in a class with the same name but different parameters
Increasing the memory allocation to a Java program
Replacing a method in a subclass with a method from the superclass
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
In Java, what is the effect of assigning a 'null' value to a reference variable?
The reference variable is deleted
It causes a compile-time error
The reference variable points to no object
It automatically initializes the object
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
What does the 'throws' keyword do in Java?
Automatically handles an exception
Declares an exception which might be thrown
Stops the propagation of an exception
Increases the throw range of an exception
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
Which method in the Object class is used to obtain a unique hash code for the object?
uniqueCode()
hashCode()
identityHashCode()
getObjectHash()
Next >
22/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 >
23/25
What is the use of the 'implements' keyword in Java?
To inherit from an abstract class
To include an interface in a class
To mark a method as mandatory to override
To declare a class as abstract
Next >
24/25
In Java, what is the function of the 'super' keyword?
To call a method of the superclass
To declare superior variables
To access the superclass's static methods
To create an object of the superclass
Next >
25/25
What is the use of the 'protected' access modifier in Java?
To restrict access to the class members within its own class only
To provide access to the class members within the same package and subclasses
To provide universal access from any other class
To prevent modification of the class members
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.