What will be the output of the following Java code? class output ...
View Question
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
String c = “Hello i love java”;
int start = 2;
int end = 9;
char s[]=new char[end-start];
c.getChars(start,end,s,0);
System.out.println(s);
}
}
What will be the output of the following Java code? class output ...
View QuestionWhich of these methods can be used to convert all characters in a String into a character array?
a) charAt() b) both getChars() & charAt() c) both toCharArray() & getChars() d) all of the ...
View Question
What will be the output of the following Java code?
public class Boxer1
{
Integer i;
int x;
public Boxer1(int y)
{
x = i+y;
System.out.println(x);
}
public static void main(String[] args)
{
new Boxer1 (new Integer(4));
}
}
What will be the output of the following Java code? public class Boxer1 { ...
View Question
In the following Java code, what can directly access and change the value of the variable name?
package test;
class Target
{
public String name = “hello”;
}
In the following Java code, what can directly access and change the value of the variable name? ...
View QuestionWhich of these methods is an alternative to getChars() that stores the characters in an array of bytes?
a) getBytes() b) GetByte() c) giveByte() d) ...
View QuestionWhich of these method of class String is used to extract more than one character at a time a String object?
a) getchars() b) GetChars() c) Getchars() d) getChars() Answer: d Explanation: getChars()
View Question
What will be the output of the following Java program?
class String_demo
{
public static void main(String args[])
{
char chars[] = {‘a’, ‘b’, ‘c’};
String s = new String(chars);
String s1 = “abcd”;
int len1 = s1.length();
int len2 = s.length();
System.out.println(len1 + ” ” + len2);
}
}
What will be the output of the following Java program? class String_demo ...
View Question
What will be the output of the following Java program?
class String_demo
{
public static void main(String args[])
{
int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
System.out.println(s);
}
}
What will be the output of the following Java program? class String_demo ...
View Question
What will be the output of the following Java program?
class String_demo
{
public static void main(String args[])
{
char chars[] = {‘a’, ‘b’, ‘c’};
String s = new String(chars);
System.out.println(s);
}
}
What will be the output of the following Java program? class String_demo ...
View Question