and Answers Already Passed
What is the default value of a boolean variable in Java?
✔✔ false
How do you declare a method that does not return a value?
✔✔ Use the `void` keyword
What keyword is used to create a subclass in Java?
✔✔ extends
How can you check the length of an array in Java?
✔✔ Using `array.length`
Which Java class is used to take user input?
✔✔ Scanner
1
,What does the `static` keyword do in Java?
✔✔ It associates a variable or method with the class rather than an instance
How do you create a new object in Java?
✔✔ Using the `new` keyword
Which method is used to convert a string to lowercase?
✔✔ `toLowerCase()`
How do you compare two strings in Java?
✔✔ Using the `equals()` method
Which keyword is used to stop a loop immediately?
✔✔ break
What happens when a method does not return a value but tries to return something?
✔✔ Compilation error
2
, How do you access the first element of an array?
✔✔ `array[0]`
Which operator is used to find the remainder of a division?
✔✔ `%`
What will `System.out.println("Java".charAt(2));` print?
✔✔ v
What will be the output of `System.out.println();`?
✔✔ 3
How do you handle exceptions in Java?
✔✔ Using try-catch blocks
What does `this` keyword refer to?
✔✔ The current instance of the class
3