Kian Ng

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

Recent posts by Kian Ng

it was pretty easy, i got 93%. surprise on myside cos i usually score 70's something in mocks. I have been practising Dan Chisholm's mock exam and it's really good, u learn as u practise thru e question. very tricky so kinna jugger your mind alot.
http://www.danchisholm.net/dec20/topic/
17 years ago
realli wanna to say a big thanks you to everyone out there!!! thanks for e helps!!! you guys are great!!!

*if u can handle e mocks recommended in this forum, u can handle anything sun can throws at you!!!

another happy java programmer,
kianz
17 years ago
hi, any special requirements for purchasing the voucher? anyway thanks alot! rushing down tomorrow 1st thing in e morning, wanna to take e exam on thurs!!!
help! i cant book e java exam on promtetric website, i was asked for an voucher number, what is that, where can i get one? i'm from s'pore... thanks
thanks guys!!! cos i have always thought tat by extending the superclass with the protected variables/methods, its features can be made available to the subclass and other classes that uses the subclass...
hey guys i made a mistake there, sorry man, all e classes in duckpack is suppose to "extends" the Bird class. And tat is what makes me so puzzled. arent dervied classes be allow to access the protected variables?
Help... Still puzzled, many thanks!!!
package birdpack

public class Bird
{
protected int n;
}
------------------------------------------------------------------------------
package duckpack
import birdpack.*;

class Duck1
{
void m()
{
n=100;
}
}
//compiles!
----------------------------------------------------------------------------
package duckpack
import birdpack.*;

class Duck2
{
void m()
{
Duck2 d= new Duck2();
d.n=100;
}
}
//compiles!
----------------------------------------------------------------------------
package duckpack
import birdpack.*;

class Duck3
{
void m()
{
Bird b=new Bird();
b.n=100;
}
}
//failed, error: n has protected access in birdpack.Bird
----------------------------------------------------------------------------
package duckpack
import birdpack.*;

class Swan
{
void m()
{
Duck1 b=new Duck1();
b.n=100;
}
}
//failed, error: n has protected access in birdpack.
----------------------------------------------------------------------------

can someone explain why the bottom 2 classes failed to compile?
thanks alot! (headache...)
bro, i think D is wrong cos inner class cannot have static method definition..
Compilation error? cos i remember static modifier cannot be used on local variables in methods... onli final can be applied. hope it answer your question