Bijendra S. Rajput

Ranch Hand
+ Follow
since Sep 19, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Bijendra S. Rajput

Hi

I suggest you to go thru the k&B 1.5 book, its explain this very nicely.

I can just give you some hints that

<T super Number> means T is a super class of Number, actually which is not correct, so it can not work.

The abstract class Number is the superclass of classes Byte, Double, Float, Integer, Long, and Short.

<T extends Number> means Number is a super class and T is extending that class, so it is valid and we can pass T as Interger, Long etc.
Hi

The pattern is "C.L" means .....find C (0 or more) then .(any char)and then followed by L, so .....in "CooLooLCuuLooC". I think now you can understand that your result is correct ..
Result is
2 oL
5 oL
9 uL
Hi Amit,

I think you haven't gone thru the complete book.
see the chap-6 for Pattern and Matcher classes.
Hi Pankaja,

Yes, the ans of this question is F. This will fail at compile time.
The reason is that print() is a static method and when we are calling this method inside test() method, we are using this which is totally wrong. With static methods we can not use this keyword, static methods belongs to class. So this program will not compile.

if you can modify, like this

public static void test(){
print();

}


then this program will run and output will be "Test".
Hi Sangeev,

see here ....

int[] b = (int[]) a[1]; // in this line we are assigning a[1] array which has the value {3,4};

Now if i will print b[1], the value is 4, i think you got.
Hi Michael,

The sun voucher is same for 1.4 and 1.5. Once you purchaseed the voucher then before expire it, you have to take the exam. When you will register for the exam at that time you have to tell that for which exam you want to register.
Hi neha,

yes, we can change the Priority of a thread after calling the start method.
but there is no use of it. we have already completed our work by calling the start method.
Hi,

Try to observe one thing.....we are increasing the i 's value but not assigning to any variable.

if value of i=0

i=i++;

after this statement....the value of i do not change. Because we are assigning 0 to i and then increasing i 's value with 1, but we are not assigning new value of i to any variable, so the value of i still is 0;
Hi,

I took this question from javabeat site.

Question:-
Which ones of the following lines can be compiled without an error?

a)Basket b = new Basket();

b)Basket b1 = new Basket<Fruit>();

c)Basket<Fruit> b2 = new Basket<Fruit>();

d)Basket<Apple> b3 = new Basket<Fruit>();

e)Basket<Fruit> b4 = new Basket<Apple>();

f)Basket<?> b5 = new Basket<Apple>();

g)Basket<Apple> b6 = new Basket<?>();

Ans. a, b, c, f

But according to me, the answer should be a,c and f.
I did not get why ans b is also correct.
Can anyone through a light on it.
Hi Jesse,

I am really surprized why seeing the output of this program with

java Regex2 "\d*?" ab34df

m.group() is not printing anything.......confused......

can you help me please...
Hi,

In K & B book, last chapter is related to all these stuffs. And its very nice.
Go thru it...........
[Offer Deleted]


[HENRY: Sorry for editing this post. I wasn't sure what you were offering to send. And sending copyrighted materials is prohibited here.]
[ February 15, 2007: Message edited by: Henry Wong ]
hi Vats,

I am doing. I do not have any experience in JAVA. But I want to change of field so first thing I want to clear SCJP 1.5 and then it will help me to get a job in JAVA.
Hi Quintin,

I am agree with your 1st point....good.

I am sorry to say but your second point it not correct..see this from K & B

a protected member can be accessed (through inheritance) by a subclass even if the subclass is in a different package.