Questions and Answers
What is the purpose of inheritance in Java?
To allow a class to inherit properties and behaviors from another class
What does the length() method return for the string 'RockStar'?
9
What does the indexOf method return for the character 'S' in the string 'RockStar'?
5
What does the charAt(5) method return for the string 'RockStar'?
Signup and view all the answers
What does the contains method return for the characters 'tar' in the string 'RockStar'?
Signup and view all the answers
What does the replace method return for replacing 'Rock' with 'Duke' in the string 'RockStar'?
Signup and view all the answers
What is a Java String in technical terms?
Signup and view all the answers
Why are Strings important in computer science?
Signup and view all the answers
What is the result of concatenating two strings in Java?
Signup and view all the answers
What does the 'Length' method in Java String class do?
Signup and view all the answers
How is a String represented in Java?
Signup and view all the answers
What is the primary purpose of expressions in Java?
Signup and view all the answers
Which statement is used to evaluate a condition in Java?
Signup and view all the answers
Which type of statement is used to control the flow of Java code?
Signup and view all the answers
What is the purpose of a loop statement in Java?
Signup and view all the answers
What is the purpose of the if-else statement in Java?
Signup and view all the answers
What is the main difference between the if-else statement and the if-else-if ladder?
Signup and view all the answers
In nested if-statements, what happens if the condition of the outer if-statement is false?
Signup and view all the answers
What is the main advantage of using a switch statement over if-else-if statements?
Signup and view all the answers
When is the for loop in Java used?
Signup and view all the answers
What is the initial capacity of an empty list constructed using the ArrayList class in Java?
Signup and view all the answers
Which package is the ArrayList class implemented in?
Signup and view all the answers
What type of implementation does the ArrayList class provide for the List interface?
Signup and view all the answers