Question 1
Which of these words belong to the set of java key words.
- byte
- short
- int
- long
- decimal
- int64
- float
- single
- double
- boolean
- char
- unsigned
- array
- string
- None of the above
Question2
- package com.dan.chisholm;
- public class A {
- public void m1() {
- System.out.println("A.m1, "); }
- protected void m2() {
- System.out.println("A.m2, "); }
- private void m3() {
- System.out.println("A.m3, "); }
- void m4(){
- System.out.println("A.m4, "); }
- }
- class B {
- public static void main(String args[]){
- A a = new A();
- a.m1();
- a.m2();
- a.m3();
- a.m4();
- }
- }
Assume that the above code appears in a single file named A.java. What is the result of attempting to compile and run the above program?
- Prints A.m1, A.m2, A.m3, A.m3, A.m4,
- Compiler error at line 16
- Compiler error at line 17
- Compiler error at line 18
- Compiler error at line 19
- None of the above.
Question 3
class Violet {
public static void main(String s[]){
System.out.println(s[1]+s[2]+s[3]);
}
}
Assume the above main method is invoked using the following command line.
java Violet A B C D E F
What is the result of attempting to compile and run the program using the specific command line?
- Prints: ABC
- Prints: BCD
- Prints: CDE
- Prints: ABC
- Prints: BCD
- Prints: CDE
- Compile Error
- Run time Exception
- None of the above
No comments:
Post a Comment