Which of the following are legal array
- declarations?
(i) int [ ] myScores [ ];
(ii) char[ ] myChars;
(iii) int [6] myScores;
Which of the following is not considered as an OOPS concept in Java?
The component that is responsible for converting bytecode into machine specific code________.
What will be output of the following code?
Byte x = 64, y;
Y = (byte) (x< < 2);
System. out. Println (y):
Which options describe the correct default values for array elements of the types indicated?
i. int → 0
ii. String -> “null”
iii. char → ‘u0000’
iv. float → 0.0 f
v. Boolean → true
Which one of the following will declared an array and initialize it with five numbers?
Given two files, what will be the output?
package pck1;
public class A
{
int x=10:
public int y- 20:
}
package pck2:
import pck1.*;
class Test
{
public static void main
(String [ ] args)
{
A a= new AO: //line 7
system.out.println(a.x):
// line 8
system.out.println(a.y):
// line 9
}
}
Fill in the blank to compile the code
successfully.
abstract class A
{
int a = 100:
public abstract void showA ( ):
}
public class B extends A
//Fill the
Blank
public static void main(String[]args)
{
A objA = new A():
objA.showA():
}
}
In Java, elements of an array are automatically initialized to some default value. What is the default value for the elements of an array of integers?
You want to initialize all the elements of a double array a to the same value equal to 1.5.
What could you write?
Assume that the array has been correctly initialized.