Characters
- 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));
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Because we are performing operation on reference variable which is null.
- In below code, what can directly access and change the value of the variable name?
package output;
class Test
{
public String name = "Interview Mania";
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Any class in the output package can access and change name.
- Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?
-
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.
- Which of these method of class String is used to extract more than one character at a time a String object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
GetChars()