Submitted by c-admin on Sat, 05/25/2019 - 23:16
The options below contain the complete contents of a file (the name of the file is not specified).
Which of these options can be run with the following command line once compiled?
java main
Select 1 option
A. //in file main.java
class main {
public void main(String[] args) {
System.out.println("hello");
}
}
B. //in file main.java
public static void main4(String[] args) {
System.out.println("hello");
}
C. //in file main.java
public class anotherone{
}class main {
public static void main(String[] args) {
System.out.println("hello");
}
}
D. //in file main.java
class anothermain{
public static void main(String[] args) {
System.out.println("hello2");
}
}class main {
public final static void main(String[] args) {
System.out.println("hello");
}
}
Submitted by c-admin on Sat, 05/25/2019 - 23:12
What is the correct parameter specification for the standard main method?
Select 2 options
A. void
B. String[ ] args
C. Strings args[ ]
D. String args
E. String args[ ]
Submitted by c-admin on Sat, 05/25/2019 - 23:10
Which of the following are valid declarations:
Select 3 options
A. int a = b = c = 100;
B. int a, b, c; a = b = c = 100;
C. int a, b, c=100;
D. int a=100, b, c;
E. int a= 100 = b = c;
Submitted by c-admin on Sat, 05/25/2019 - 23:08
Which of the following is/are illegal Java identifier(s)?
Select 1 option
A. num
B. int123
C. 2Next
D. _interface
E. a$_123
Submitted by c-admin on Sat, 05/25/2019 - 23:04
Consider the following code appearing in a file named TestClass.java:
class Test{ } // 1
public class TestClass {
public int main(String[] args) { // 2
double x=10, double y; // 3
System.out.println[]; // 4
for(int k =0; k<x; k++){ }
return 0;
}
}
Which of the lines are invalid?
Select 1 option
A. // 1 and // 4
B. // 3 and // 4
C. // 2 and // 4
D. // 2 and // 3
Pages