Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Java program?
class output
{
public static void main(String args[])
{
StringBuffer c = new StringBuffer(“Hello”);
c.delete(0,2);
System.out.println(c);
}
}

What will be the output of the following Java program?
class output
{
public static void main(String args[])
{
StringBuffer c = new StringBuffer(“Hello”);
c.delete(0,2);
System.out.println(c);
}
}
a) He
b) Hel
c) lo
d) llo

Answer: d
Explanation: delete(0,2) is used to delete the characters from 0 th position to 1 st position.
Output:
llo

Join The Discussion