Nasir Khan

Ranch Hand
+ Follow
since Nov 04, 2000
Merit badge: grant badges
For More
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 Nasir Khan

I arranged my notes on certification preparation here
It's not completed yet but time after time I put new pages ...
Since i'm a java teacher in a local institute i build a forum(servlet based)for certification preparation for my students ..
People from java Ranch are welcome to participate......

[This message has been edited by Nasir Khan (edited April 01, 2001).]
Hi Angela,
I tried these
SmtpClient sc=new SmptClient("");
SmtpClient sc=new SmptClient("");
but still can't make it....
22 years ago
HI ,
I'm trying to send an email from servlet using class..
I'm using PostCast server(SMTP server) running on my computer ,The settings are
host name: nasir
server port : 25
Since SmtpClient api is not available I don't know what to put in the constructor.I tried with following but none is working
SmtpClient sc=new SmptClient("nasir:25");
SmtpClient sc=new SmptClient("nasir:2025");
SmtpClient sc=new SmptClient("nasir 2025");
Please help me....
[This message has been edited by Nasir Khan (edited March 14, 2001).]
22 years ago
Thanks Frank,
It means jsp can only be used for page generation.After page has been loaded we have to use client-side script like javaScript to change the content of the page.Am I right?
22 years ago
Can i access a layer from a jsp scriptlet?For example
<layer id="test" width=80px height=80px></layer>
<%@ page language="java" %>
// here i wanna access the layer,like test.bgColor="blue"
22 years ago
Hi ,
I've been trying to use jdbc_odbc driver to access server site data source(ms access) from applet but realized that i can do that only on window platform.
Could someone help me which jdbc driver to use??
I took the exam on 04 january and passed with 89%
I started learning java 6 months back and have been preparing for the exam since sept2000...
I suggest all to pay particular attention on Thread ,Language Fundamentals ,overloading,overiding,runtime type and object orientations....
Another thing whenever you learn something ,write some code and do some experiment on that .
I'll like to thank all who helped me in this Forum...
JavaRanch is really a helping place

23 years ago
Hi ,
Consider the code
class vari{static int x=1;
static {System.out.println("value of x in vari's static block is "+x);}
{System.out.println("assigning "+(x=2));}
class vari1 extends vari{
static int x=3;
static {System.out.println("value of x in vari1's static block is "+x);}
{System.out.println("Now value of x is "+x);}
public static void main(String d[]){
new vari1();
value of x in vari's static block is 1
value of x in vari1's static block is 3
assigning 2
Now value of x is 3
As output shows I assume that order of code execution is
=> static variables initialization and then static initializer block execution in super class.
=> static variables initialization and then static initializer block execution in sub class.
=> instance initializer blocks execution in super and then in sub class
The way I think about the code execution is correct...or something else goes on here..?
Also I think last line of output should be 2 instead of 3 because x just has been assigned a value of 2 in super's instance
initializer block...

One more change should be with Box'constructor....
replace height = w; with height=h;
because if you create the Box object with different parameters e.g. Box b = new Box(5,1,2);You wouldn't get the desired
value of volume....
The easiest Solution to the original code might be making Rectangle's setArea method 'private'.
[This message has been edited by Nasir Khan (edited December 23, 2000).]
yes naveen ,all components inherit everything from Component class.A Label can generate MouseEvent,MouseMotionEvent etc.
Here's an example
import java.awt.*;
import java.awt.event.*;
class label extends Frame{ Label l;
label(){ setLayout(new FlowLayout());
l=new Label("come as you are");
public static void main(String s[]){
final label e=new label();
e.l.addMouseListener(new MouseAdapter(){
public void mouseEntered(MouseEvent d){
e.l.setText("as you were");}
public void mouseExited(MouseEvent d){
e.l.setText("as i want you to be");
} });

Not only this you can use paint method to all of the components as well.You can draw a small circle or an image on a
Button,on a Label,on a CheckBox etc etc.
That's why I'm confused in the case of CheckboxMenuItem which 'is a' MenuItem if a MenuItem can generate a
ActionEvent why CheckboxMenuItem can't ??....

[This message has been edited by Nasir Khan (edited December 20, 2000).]
hi Friends,
Can CheckboxMenuItem generate ActionEvent?

Though CheckBoxMenuItem generates ItemEvent but it should generate ActionEvent as well b/c addActionListener method is
inherited from its super class MenuItem...
I tried with some code, it's working with Menu(another subclass of MenuItem) but not with CheckBoxMenuItem..
please Help!

ClassCastException is thrown when key cannot be compared with the keys currently in the map.
TreeSet is backed up by TreeMap which can't accept null key or any key which cannot be compared with the keys currently
in the map.......
TreeSet's add(Object obj) method calls TreeMap's put(Object key,Object vlaue) method and places obj in the place of
As much I know a local inner class can't be static also it can't has access modifiers public,protected or private, it can only be
final or abstract..