Tag: programming languages

Questions Related to programming languages

You can traverse through the elements of many Java Collection objects because they provide a way to access their elements sequentially. What design pattern is used here?

  1. Visitor

  2. Observer

  3. Builder

  4. Proxy

  5. Iterator


Correct Option: E

package constructors; class U { U() { System.out.println("I am in U"); } } class V extends U { void V() { System.out.println("I am in V"); } } public class TestConstructor5 { public static void main(String[] args) { V v = new V(); } }

  1. I am in U

  2. Compiler Error

  3. I am in V

  4. I am in U I am in V


Correct Option: A