may leung

+ Follow
since Nov 28, 2000
Merit badge: grant badges
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 may leung

I've got this result too
any suggestion??
21 years ago
Hey guys!!
I get certified today with 64%. Not a very great score but I am happy with it~~ I am a student with no real world experiences at all. I have no programming language background and I leant Java for about 2-3 months by reading books and doing online exams~ Now, I am preparing find a job. Hopes the java certification really helps!!!
I've got 100% on declarations and access control, garbage collection and java.util package. For me, Thread questions are quite difficult. I only got 42%. IO is not too difficult, given u are familiar with the constructors( beware the buffer one) and I got 80% in this part.
Again, Thanks all guys that helped me and ans my questions before, expecially maha!! Her site is really great~~~~
21 years ago
class Base {
int i;
void add (int v){
void print(){
System.out.println (i);
class Extension extends Base{
void add(int v){
i += v*2;

public class Test {
public static void main (String args []) {
bogo(new Extension());
static void bogo(Base b){
a. 9
b. 18
c. 20
the ans is 22 but I am quite confuse in this question, can anyone explain in detail?
boolean flag = false;
if (flag = true) {
} else {
a true is printed to standard out
b false is printed to standard out
c An exception is raised
d Nothing happens
The ans is d, But I think the ans should be A. Can anyone tell me the true?
public class Test {
static int total = 10;
public static void main (String args []) {
new Test();
public Test () {
System.out.println("In test");
System.out.println(this);// line 1
int temp =;// line 2
if (temp > 5) {
In this question, the ans is 10 is one of the output.
But my question is what is the" this "in line one means? I complile the program and it outputs some numbers seem no meanings.
And for line 2, I put total instead of still got the same result. In this case, Is there any different that I use this or no this ??
33. What will happen when you attempt to compile and run this code
//Demonstration of event handling
import java.awt.event.*;
import java.awt.*;
public class MyWc extends Frame implements WindowListener{
public static void main(String argv[]){
MyWc mwc = new MyWc();
public void windowClosing(WindowEvent we){
}//End of windowClosing
public void MyWc(){
}//End of class
why there would be a complier error occur??
48. Given the following variables
char c = 'c';
int i = 10;
double d = 10;
long l = 1;
String s = "Hello";
Which of the following will compile without error?
the ans is 2, but why 3 and 4 not??

58. You have these files in the same directory. What will happen when you attempt to compile and run if you have not already compiled
package Base;
class Base{
protected void amethod(){
}//End of amethod
}//End of class base
package Class1;
public class Class1 extends Base{
public static void main(String argv[]){
Base b = new Base();
}//End of main
}//End of Class1
1) Compile Error: Methods in Base not found
2) Compile Error: Unable to access protected method in base class
3) Compilation followed by the output "amethod"
4)Compile error: Superclass Class1.Base of class Class1.Class1 not found
the ans is 4 but I chose 1. I don't understand what the compile error in 4 said about.

59.class Base{
private void amethod(int iBase){
class Over extends Base{
public static void main(String argv[]){
Over o = new Over();
int iBase=0;
public void amethod(int iOver){
1) Compile time error complaining that Base.amethod is private
2) Runtime error complaining that Base.amethod is private
3) Output of "Base.amethod"
4) Output of "Over.amethod"

the ans is 4. In this overriding, I understand the name of parameter doesn't matter, I want to ask is the base class declare private but supclass declare public, why they still can override?
Kindly explain these for me!!
public boolean strCrt(String s){
factor = Float.valueOf(s).floatValue();
return true;
catch(NumberFormatException e){
System.out.println("Bad number " + s);
factor = Float.NaN;
return false;
Input ="1.2"-Result:factor = 1.2, true is returned, nothing is printed.
Input = ""-Result:factor unchanged, Finally is printed, false is returned
Input = ""-Result:factor=NaN,"Bad number finally is printed,falsed is returned
ans is C
I really don't understand this problem, anyone explain to me?

Given that a might occur when calling the read() method of the BufferedInputStream, you can handle the exception by:

a) Listing a in a throws list.

b) Catch the java.lang.Exception using the throw statement.

c) Catch a using a try/catch clause.

d) Catch a java.lang.Exception using a try/catch clause.

Can anyone explain this to me??
You have an application that executes the following line: Thread myT = new Thread(); Select all of the following statements that are correct. [Check all correct anwers]
A) The Thread myT is now in a runnable state.
B) The Thread myT has the priority of the Thread that executed the construction statement.
C) If myT.start() is called, the run method in the class where the construction statement appears will be executed.
D) If myT.stop() is called, the Thread can later be started with myT.start() and will execute the run method in the Thread class.

The ans is B. I am not very understand what it said in B and C! can anyone explain to me?
Thanks in advance and happy new year
public class Test {
public static void main(String Args[]){
for (int i=0; i< 10; ++i){
if( i%3 ==0) throw new Exception("EO");
if(i%3==1) throw new Exception("E1");
}catch(Exception inner){
} finally {
}catch (Exception outer){
i +=3;
(choice: 4,5,6,7,8,9)The ans is 5 and 8.
Can anyone explain this in detail for me?
class Threadable implements Runnable {
public void run() {
System.out.println("Start running..");
class Base {
static public void main(String[] a) {
Threadable aFace = new Threadable();
Thread aThread = new Thread(aFace);
why this is an infinite loop of printing out "Start Running" but not print "Start Running" only once??

public class Base{
private int i;

static public void main(String[] a) {
System.out.println("Value is: " + i);
Select most appropriate answer(s).
a) Value is: 0
b) Compile time error. Can't access the private variable i defined in class Base.
c) Compile time error. Can't make a static reference to nonstatic variable i in class Base.
d) Runtime error. Variable i is uninitialized
e) Compile time error. Variable i is uninitialized
f) None
the ans is C. is that mean all the variable used in the main method should be static?? Can anybody clarify for me??
Thank you~~
I get it!
public class Base{

private void test() {

boolean flag = false;
System.out.println("001 Flag is true");
else {
if (flag=true)
System.out.println("002 Flag is true");
System.out.println("003 Flag is false");


static public void main(String[] a) {
new Base().test();

Select most appropriate answer.
a) 001 Flag is true
b) 002 Flag is true
c) 003 Flag is false
d) None
the ans is b, can anyone explain this to me? thanks~~