naren babu

+ Follow
since Sep 20, 2003
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by naren babu

thanks for your answers
class A {void m1(A a) {System.out.print("A");}}
class B extends A {void m1(B b) {System.out.print("B");}}
class C extends B {void m1(C c) {System.out.print("C");}}
class hammer3 {
public static void main(String[] args) {
A a1 = new A(); B b1 = new B();
C c1 = new C(); A c2 = new C();
c2.m1(a1); c2.m1(b1); c2.m1(c1);

Since c2 is of object type C I expect CCC
But the answer is AAA.
this piece of code
class MWC105 {
static boolean b1;
public static void main(String[] args) {
boolean[] array = new boolean[1];
boolean b2;

This is the answer
b1 is initialized to null, because it is a class member. The array component array[0] is initialized to the default value of the array type even though the array is declared locally. Local variable b2 is not initialized, because it is local. A compile-time error is generated by the statement that attempts to print the value of b2.
I wanted to know what the default value of the array type boolean is.
Also would b1 be different if it was not static.
-- Naren
What will happen when you attempt to compile and run this code?
public class Mod{
public static void main(String argv[]){
public static native void amethod();
1) Error at compilation: native method cannot be static
2) Error at compilation native method must return value
3) Compilation but error at run time unless you have made code containing native amethod available
4) Compilation and execution without error
My response was number three since amethod() was not defined
thanks for the quick response
Hi folks,
I was planning to take the SCJP exam. I could not find information on the SCJP exam format on the Sun web site. Can anyone point me to the proper link ?
My understanding is that there are around 60 multiple choice questions.
How many choices are there for each multiple choice question ?
Are there questions where you have more than one correct answer ?
-- Naren