Skip to content
J2J Institute
Search
K
Main Navigation
Home
Jobs
Code here
Courses
Java
Core
Advanced
Python
SQL
PowerBI
Testing
Manual
Automation
Interview Questions
Java
Python
SQL
Manual
Automation
Quiz
Java
Python
SQL
Appearance
Menu
Return to top
On this page
Beginner level java quiz
Which of the following is used to handle exceptions in Java?
try-catch
throw-throw
catch-finally
try-finally
Which of these is a valid constructor in Java?
public MyClass() {}
public MyClass[]() {}
private MyClass() {}
void MyClass() {}
Which method is used to find the length of a string in Java?
size()
length()
getSize()
count()
What is the size of an `int` in Java?
16 bits
32 bits
64 bits
128 bits
Which of the following is not a valid loop type in Java?
for loop
while loop
do-while loop
repeat loop
Which of the following is used to declare an array in Java?
int[] arr = new int[5];
array arr = new int[5];
int arr[5];
int arr = new int(5);
Which of the following is the correct way to declare a variable in Java?
int number = 10;
number int = 10;
10 int number =;
int 10 = number;
What does the `continue` statement do in a loop?
Exits the current loop iteration and moves to the next iteration
Skips the current loop iteration and continues with the next one
Terminates the entire loop
Stops the program execution
Which of the following is used to convert a string to an integer in Java?
Integer.parseInt()
String.parseInt()
Integer.toInt()
String.toInteger()
What will be the output of the following code? System.out.println(10 / 4);
2.5
2
4
0
Submit