hanmeng

Greenhorn
+ Follow
since Aug 16, 2000
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 hanmeng

Hi,
Someone please tell me , how to make applet to communicate with Servlet. please give me a sample to explain. please.
meng
23 years ago
Hi Ayman,
Congratation!!!
Please send the mock links at han@fsiinc.com too.
Thanks in advance,
hanmeng

Given the following class definitions, which expression identifiers whether the object referred to by obj was created by instantiating class B rather than classes A, C and D?
class A {}
class B extends A{}
class C extends B{}
class D extends A{}
Select all valid answers.
a). obj instanceof B
b). obj instanceof A && !(obj instanceof C )
c). obj instanceof B && !(obj instanceof C )
d). !(obj instanceof C | | obj instanceof D )
e). !(obj instanceof A) && !(obj instanceof C) && !(obj instanceof D)
The Answer is (c). But I think it should (a), (b), (c), (d).
Please explain for me. I really confused why not (a) (b), it's so clearly belong to A, and B.
Thank you
hanmeng
------------------
Thank you, Sandeep Potnis
thanks again
hanmeng
Hi,
Who can help me to tell why the result is 22. I need show the procedur clearly. Thank you very much.
han
=================================================
class Base {
int i;
Base() {
add(1);
}
void add(int v) {
i +=v;
}
void print() {
System.out.println(i);
}
}
class Extension extends Base {
Extension() {
add(2);
}
void add(int v) {
i += v*2;
}
}
public class Qd073 {
public static void main(String args[]) {
bogo(new Extension());
}
static void bogo(Base b) {
b.add(8);
b.print();
}
}
Dear anil kuchana
Please e-mail to me the tutorial: han@fsiinc.com
Thanks
hanmeng
Thank you santoo,
I see.
Han meng

Originally posted by santoo lutina:
I just check my note, I find that:
b.x -----> Subclass --------->extends Base ------->Base
------>Base.x=2.
please tell me I am wrong
santoolutina


Hi, Thank you for replay. I mean why the result is 2, 3. What's the precedure.
han
Somebody can help me why the following result is 2, 3?
I just consider that is 3, 3. Could you please tell me the procedure. Thank you very much!
Han
==========================================
class Test {
public static void main(String args[]) {
Base b = new Subclass();
System.out.println(b.x);
System.out.println(b.method());
}
}
class Base {
int x = 2;
int method() {
return x;
}
}
class Subclass extends Base {
int x = 3;
int method() {
return x;
}
}
Hi, Could you please e-mail Amit poddar's mock exam to me:
han@fsiinc.com
thank you very much!
Hanmeng
Doit
Could you please tell us, where do you get so good Mock Questions? Could you e-mail those to me? Thank you very much!
My address is hanmeng@usa.net
Sincerely yours
Han
Hi, Doit,
I compile the file, it's passed. but it does not run--exception in thread "main" java.lang.NoSuchMethodError: main
==================================
import java.awt.*;
import java.awt.event.*;

public class MyFrame extends Frame {
public MyFrame(String title) {
super(title);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
}
public void processWindowEvent(WindowEvent we) {
System.out.println("Processing a window event.");
}
}
Thank you Ajith and Sachin
this words come from our class material book that not english words. I just translate it into Eglish
han
According the book: if super class is abstract, the subclass must be abstract or all methods must be abstract.
But I compiled following file. It's good, its subclass is not abstract, why it compiled with non-complain?
=====================================
abstract class Base{
abstract public void myfunc();
public void another(){
System.out.println("Another method");
}
}
public class Abs extends Base{
public static void main(String argv[]){
Abs a = new Abs();
a.amethod();
}
public void myfunc(){
System.out.println("My func");
}
public void amethod(){
myfunc();
}
}
1) The code will compile and run, printing out the words "My Func"