Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scjp Exam questions. Please help

 
lakshmi Nanda
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am new to Software Indus. I wrote SCJP 1.5 Exam. I got these qest. Can anybody help me. Thanks in advance.

1. static final int a[];
static {
a[0] =2;
}
What Exception will it throw?
The options given are :
a.staticIntializationExcetpion
b.statkOverFlowError
c.some exceptions
d.some exceptions

I think this code will cause a compiler error. But There is no compiler error in the options.

----
2.public class a{

//some code
public class aa implements Runnable{

//some code which produces some numerical output



}
}

What is the output ?

There is no compiler error in the option.

I think there shouldn't be more than one public class def. in a file. right?

------
3.class A {

void somemethod(){

}

class B extends A

void somemethod(){
}


What is the output when somemethod() called?

In the question they didn't mention how the somemethod() is called like

A a = new A();
a.somemethod();

or.

A ab = new B();

ab.somemethod();

or.

B b = new B();

b.somemethod().

If Iam wrong please correct me. thanks .
Also What is the best way to prepare for the Drag and Drop questions. I got many of them.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this carefully
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the answers seem to be correct, What has confused you then??
Thanks
Deepak
 
lakshmi Nanda
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Barry

Thanks for the advise. I understand.

I only gave the similar ones not exactly the same questions. In order to explain my doubts clearly.

Can I still dicuss about the topics, as general java doubts.

Thanks

Lakshmi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic