Explain the statement ABC obj=new ABC();
d. System.out.println(“PROCESS”.startsWith(“pRO”));
System.out.println(Math.sqrt((int)“Quiz”.charAt(0)));
Answers
Answered by
1
Answer:-
Given statement.
ABC obj=new ABC();
The following statement creates object named obj of ABC class.
Second statement,
System.out.println(“PROCESS”.startsWith(“pRO”));
It checks whether the string "PROCESS" starts with "pRO" or not. Here the string starts with PRO but not pRO(both are same but of different case) , so it returns false.
Output:- false.
Third statement.
System.out.println(Math.sqrt((int)“Quiz”.charAt(0)));
"Quiz".charAt(0) extracts the character at first index from the string "Quiz" which is 'Q'.
ASCII value of Q is 81.
81 is converted to integer here.
Math.sqrt(81) calculates the square root of 81 which is equal to 9.0
Output:- 9.0
Similar questions
Social Sciences,
2 months ago
Social Sciences,
2 months ago
Hindi,
2 months ago
Math,
5 months ago
English,
5 months ago
Computer Science,
10 months ago
Math,
10 months ago