bhakti soman

Greenhorn
+ Follow
since Nov 12, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by bhakti soman

HI all
above to all you can't override final method

Originally posted by Bhaswati Karmakar:
In order to override a method, what are things that should be taken into consideration ?
Thanks


Any body Interested to by my jcp coupen it is valid for more 11 months Please mail me to bhaktisoman23@yahoo.com

bhakti soman
------------------
hi Navin
i am also from mumbai and giving jcp in march
mail me at bhaktisoman23@yahoo.com
bye

Originally posted by Navin Jain:
hi got this idea from puneites.
really we mumbaites should also develop such a forum to make the
things easier.
pls let me know if u r frm mumbai and appearing for the exam in feb or march.


hi
thanks for the reply
i shall say what i have understood correct me if i am wrong
i feel that by saying addWindowListener(new WindowAdapter(){}); you are just creating a anoymonous class and by using new your anoymous class just extends this WindowAdapter class
hope this is right
bye

Originally posted by Golam Newaz:
Hi,
In your example:
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
});
// new WindowAdapter(). It says to compiler" Create an instance
of a new, unamed class which implements the WindowListener
interface...
Look here you are making an instance using new but without any object referece name . So it is unnamed class. So abstract
can be anonymous class.
Whatever you say after the "new" as in "new Something()", if Something is an interface, then the anonymous
class implements that interface (and must define all the
methods of that interface). But if Something is a class,
then your anonymous class automatically becomes a subclass of that class. This is perfect for the event adapter
classes like WindowAdapter.
- Golam Newaz


hi
please mail me at bhaktisoman23@yahoo.com
bye thanks for your help

Originally posted by Navin Narayan:
Guys, like you all, I am also giving the Java Certification.
The Mughal Khalid exam is good but it does not give answers. So
I modified it a bit so that it displays answers too. If anyone is interested, you all can mail me.



hi thanks for the help but as you said this concept is confusing
you are saying that we are not instanciating object of abract class WindowAdapter but we are instantiating an anonymous class from the WindowAdapter class ???
if we are saying new WindowAdapter that means we are creating object of that class right then ???
please explain
thanks

Originally posted by Peter Tran:
[B]Bhakti,
In your example, you're instantiating an anonymous class from the WindowAdapter class and you provide an override method for the windowClosing method. This is perfectly fine, because you are not keeping a reference of the WindowAdpater class around.
E.g.

The second example is fine, because I'm creating a reference to an anonymous class. Remember, that this anonymous class is a concrete class because I'm providing an implementation for one of the methods in the WindowAdapter class.
I hope this makes sense. I realize the concept is confusing, and takes some getting use to.
-Peter[/B]


hi navin i would like the modifies version please mail me at bhaktisoman@hotmail.com
bye
public abstract class WindowAdapter is abstract class then how can you instantiate it.
the code given below works fine with all my program
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
});
this code works,how it can work when WindowAdapter class is abract and still we instantiate it (abract calsses can't be instantiates)
please help i am really confused.
bye

hi
when i ran this code it gave answer 10 that means that when i is assigned default value 0 and now in my code it is assigned value of 10.
public class AQuestion
{
private int j = 10;
private int i = giveMeJ();
private int giveMeJ()
{
return j;
}
public static void main(String args[])
{
System.out.println((new AQuestion()).i);
}
}
i hope this is clear
hi every one
why string objects are never eligible for garbage collection
please help

Originally posted by Rajpal Kandhari:
Hello Ajith & Eveyone out here:

If code is like below,
String str="First";
str="Second";
str="Third";
str="Four";
Then after line 4, 3 objects will be eligible for Garbage Collection.
Should we conside this as the bottom line:
"How the string object is created (with new or without new) has no effect on Object eligible for GC."
Pls help us out.


hi arvind
both the code compile fine with me.i have SDK 1.3

Originally posted by Jane Griscti:
Arvind,
Looks as if Manfred is right ... you found a 'bug'.
There is something very similar reported in the Sun Bug database compile-time constants not used correctly for 'unreachable statements'
It reportedly does not occur in JDK 1.3
Hope that helps


hi every body
if you don't write private to mail method still it will work
if you write private to class c then it won't compile but
this code looks fine for me
bye

Originally posted by krishnashu:
[B]I could not get the right answer for my question
why the following code works
[/B]


thankyou carl

Originally posted by Carl Trusiak:
bhakti soman,
A link to all the exams we know about is Here.
Cristi,
BTW is an Acronym which means By The Way. Chatting made them ?famous? on the internet a Chat dictionary can be found Here


23 years ago
hi
what is the url of greens exam

23 years ago
hi atin
i feel what code was written by me will compile fine and will not run even if main method is written properly
correct me if i am wrong

Originally posted by atin sehgal:
Hi!
There are a few things which i think I shd share with u first so that i am able to convince u.
1) The mofdifier.The modifier here is defaulty ansd not public.
2) Classs level whether top level or anyother..
If the modifier is public and class is top level its a necessary condition that for compiling that
a) Source Name shd be same as class name
For efficient running(no run time error_)
a) Main method shd b perfect.

Now the case of yr example..
Your class has no access modifir => it translates to friendly or default access.
Hence the condition for efficient compiling in this case is that
1) source file != name of class file.
they can be different.. and yet compile.
For running the condition ois :
That main method shd be correct..
Feel free to touchbase if any query.
I am attching a program that i have done today itself...

//top level class with default access modifier.Class compiles.It will not compile only when main method is not perfect
class abc /* this class will compile even if the file name is different from source file name*/
//class firstdefault//I saved the file earlier as firstdefault.java/.Then changed the name to a different source name.Still it compiled...
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}

/* So conclusion...if a class file is having default access modifier , we can compile the class successfully
a) Even if source name different...from class name.
Runs successfully
a)only if main is absolutely correct.

Plz revert in case of doubt or anything wrong abt my code...
at atin_sehgal@hotmail.com