Question: What will be the output of the following code: String str = Hi; if(str.equals(Hello)); System.out.print(Potato); System.out.println(EggPlant); a PotatoEggplant b Eggplant c Potato Eggplant d Compile
What will be the output of the following code: String str = Hi; if(str.equals(Hello)); System.out.print(Potato); System.out.println(EggPlant);
| a | PotatoEggplant |
| b | Eggplant |
| c Potato Eggplant |
| d | Compile Error |
What will be the output of the following code?
String str = Hello; System.out.println(First char is : + str.charAt(0));
| a | First char is H |
| b | First char is Hello |
| c | First char is 0 |
| d | Compile Error |
What does the .charAt() String method take in as a parameter?
| a | char |
| b | int |
| c | double |
What will be the output from the following code?
String str = Hello; str += Bob; System.out.println(str.length());
| a | 9 |
| b | 5 |
| c | 4 |
| d | 8 |
True or False: the String API method .charAt() returns a String.
| True |
| False |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
