Tag: technology

Questions Related to technology

A class games.cards.Poker is correctly defined in the jar file Poker.jar. A user wants to execute the main method of Poker on a UNIX system using the command: java games.cards.Poker What allows the user to do this? A. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java B. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/.jar C. Put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/Poker.jar D. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java E. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuffijava/.jar F. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/Poker.jar

  1. A

  2. B

  3. C

  4. D

  5. E

  6. F


Correct Option: C

class Abc { int i=initialize(369); int j=initialize(); public int initialize() { return 318; } public void initialize(int i) { this.i=i; } public static void main(String a[]) { Abc abc=new Abc(); System.out.println("i="+abc.i); abc.initialize(369); System.out.println("after i="+abc.i); System.out.println("j="+abc.j); } }

  1. Error: Non static method intialize cannot accessed from static context main

  2. Error: Method initialize is already defined

  3. i=0 after i=369 j=318

  4. Error: incompatible types


Correct Option: D

class Abc { static { System.out.print("Static block "); display(); } public void display() { System.out.print("Display block "); } public static void main(String a[]) { System.out.print("Starting of Main block "); Abc abc=new Abc(); System.out.print("In the Main block "); abc.display(); } }

  1. Starting of Main block Static block In the Main block Display block

  2. Static block Display block Starting of Main block In the Main block Display block

  3. Error: Non static method cannot accessed from static context

  4. Starting of Main block In the Main block Display block


Correct Option: B

Given: classA {} class B extends A {} class C extends A {} class D extends B {} Which three statements are true? (Choose three.)

  1. The type List is assignable to List.

  2. The type List is assignable to List>.

  3. The type List is assignable to List extends B>.

  4. The type List extends A> is assignable to List.

  5. The type List is assignable to any List reference.

  6. The type List extends B> is assignable to List extends A>.


Correct Option: B,C,F