-
What is the output of this program?
public class Result
{
public static void main(String args[])
{
char chars;
chars = "hello".charAt(0);
System.out.println(chars);
}
}
-
- h
- e
- l
- o
- None of these
Correct Option: A
“hello” is a String literal, method charAt() returns the character specified at the index position. Character at index position 0th is h of hello, hence chars contains h.