πŸ“Š JAVA
Q. What is the output of the following code snippet?
Code:
String s1 = “Hello”;
System.out.println(sA)startsWith(“He”));
  • (A) True
  • (B) False
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (A) True

Explanation: The startsWith method in Java checks whether a string starts with a specified substring. In this case, sA)startsWith(“He”) returns true because the string “Hello” starts with “He”.

Explanation by: Kirti
The startsWith method in Java checks whether a string starts with a specified substring. In this case, sA)startsWith(“He”) returns true because the string “Hello” starts with “He”.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
195
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Kirti
Publisher
πŸ“ˆ
83%
Success Rate