JavaQuizzes

Quiz Guidelines

 

Multiple Choice Question

QID: 
42

Which of the following for statements are valid?

A.

for(;;){}

B.

for(int i;;){}

C.

for(int i;;i++){}

D.

for(int i=0;;i++){}

E.

int i = 0;
for(;;i++){}

F.

for(;true;){}

G.

for(int i=0;true;i++);

 

Descriptive Question

QID: 
43

Find output:

public class MyClass {

  int id;

  public static void main(String[] args) throws Exception {

    MyClass mc = new MyClass();

    mc.id=10;

    System.out.println(mc.clone().id);

  }

}

 

Descriptive Question

QID: 
44

Find output:

public class MyClass {

  int id;

  public static void main(String[] args) throws Exception {

    MyClass mc = new MyClass();

    mc.id=10;

    System.out.println(((MyClass)mc.clone()).id);

  }

}

 

Multiple Choice Question

QID: 
45

Given interface Inter

interface Inter {
	
	void myMethod();
}

Which all implementations are valid?

A.

abstract class MyAbstract implements Inter{

    public abstract void myMethod();
}

B.

abstract class MyAbstract1 implements Inter{

    abstract void myMethod();
}

C.

abstract class MyAbstract2 implements Inter{

    void myMethod();
}

D.

abstract class MyAbstract3 implements Inter{

    void myMethod() {}
}

E.

abstract class MyAbstract4 implements Inter{

    public void myMethod() {}
}

F.

abstract class MyAbstract5 implements Inter{

    public abstract void myMethod() {}
}

G.

abstract class MyAbstract implements Inter{

    @Override
    public abstract void myMethod();
}

 

Multiple Choice Question

QID: 
46

Which of the followinf interface declarations are valid.

A.

interface Inter1 {
    
    void myMethod();
    
    class inner {}
}

B.

interface Inter2 {
    
    void myMethod();
    
    static class inner {}
}

C.

interface Inter3 {
    
    void myMethod();
    
    public static class inner {}
}

D.

interface Inter4 {
    
    void myMethod();
    
    public static final class inner {}
}

E.

interface Inter5 {
    
    void myMethod();
    
    public static abstract class inner {}
}

F.

interface Inter6 {
    
    void myMethod();
    
    protected static abstract class inner {}
}

Pages

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!