Characters


  1. What will be output of the following code?

    public class Result
    {
    Integer K;
    int p;
    public Result(int q)
    {
    p = K+q;
    System.out.println(p);
    }
    public static void main(String[] args)
    {
    new Result (new Integer(8));
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Because we are performing operation on reference variable which is null.


  1. In below code, what can directly access and change the value of the variable name?

    package output;
    class Test
    {
    public String name = "Interview Mania";
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Any class in the output package can access and change name.



  1. Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    getBytes() stores the character in an array of bytes. It uses default character to byte conversions provided by the platform.


  1. Which of these method of class String is used to extract more than one character at a time a String object?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    GetChars()