WorksheetsJava Basics
Total questions: 10
Worksheet time: 5mins
Which one is a Java valid variable name?
Sum Grades
static
public
FindAverage
Static methods refer to methds that:
are private and no one can see them
can be only accessed by an object of same class
return data of type static
can be written as ClassName.methodName(arguments)
we could pass a whole array to a method as a value
True
False
which statement is correct?
int Var
boolean 15;
double var123;
int min=0
int [] array2= array1;
array2 references to array1 and points to array1's elements
array2 will be created and has the same elements as array1
nothing will happen
The output of the following code is:
int[] array = {2,4,6,8,10};
for (int i=0; i < array.length;i++){
System.out.println(array[2]);
}
2
4
6
8
10
2,4,6,8,10
6
6
6
6
6
Nothing
method signature is
method name + parameter list
same as method head
same as method body
a cool signature :)
3 + 6 / 2 * 3 - 1 + 2 =
14.5
13
5
num= 2;
x=num++;
++num;
After performing the above statements, the values of x and num are
x= 2
num= 3
x = 3
num = 4
x= 2
num = 4
x= 3
num= 3
nextInt() is used to read user's numerical input
True
False
