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
In Java, which of the following is a correct way to create a thread?
Implementing the Runnable interface
Extending the Thread class
Extending the Runnable interface
Implementing the Thread class
Next >
2/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 >
3/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 >
4/25
What is the effect of marking a method as 'synchronized' in Java?
It makes the method run faster
It allows multiple threads to access the method simultaneously
It ensures only one thread can access the method at a time
It makes the method available to all classes
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
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 >
7/25
Which of these is an immutable class in Java?
java.lang.StringBuilder
java.lang.String
java.lang.StringBuffer
java.util.ArrayList
Next >
8/25
What is the role of the 'import' statement in Java?
To include a package in the current file
To export a class to another file
To load a library at runtime
To declare a variable
Next >
9/25
In Java, what is the default layout manager for a JPanel?
FlowLayout
BorderLayout
GridLayout
CardLayout
Next >
10/25
Which method must be implemented in a class that implements the java.util.Comparator interface?
compare()
compareTo()
equals()
hashCode()
Next >
11/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 >
12/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 >
13/25
Which method is used to compare two strings for equality in Java?
compareTo()
equals()
equalsIgnoreCase()
compare()
Next >
14/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 >
15/25
What is the purpose of the 'volatile' keyword in Java?
To make a variable thread-safe by ensuring atomic access to it
To optimize the code during compilation
To indicate that a variable's value will not change
To store the variable value permanently in the database
Next >
16/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 >
17/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 >
18/25
Which method in the Object class is used to obtain a unique hash code for the object?
uniqueCode()
hashCode()
identityHashCode()
getObjectHash()
Next >
19/25
What is the main difference between a Java class and a Java interface?
A class defines object properties, an interface defines object behavior
A class can be instantiated, but an interface cannot
Interfaces support multiple inheritance, classes do not
A class is used for implementation, an interface is used for abstraction
Next >
20/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 >
21/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 >
22/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 >
23/25
In Java, what is the purpose of the 'enum' keyword?
To define a new exception type
To declare a collection of constants
To create an enumeration of values for iteration
To optimize memory usage in large applications
Next >
24/25
In Java, what is 'exception chaining'?
Linking multiple exceptions together
Creating a chain of methods that can throw exceptions
Catching multiple exceptions in one catch block
Calling a method that throws an exception from another that also throws an exception
Next >
25/25
What does the 'static' keyword signify when applied to a block of code in Java?
The code block is related to the static members of the class
The code block cannot be modified
The code block is executed when the JVM loads the class
The code block is executed immediately after the class is instantiated
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.