File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes wats the problem in creating mutiple instance for class in this code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "wats the problem in creating mutiple instance for class in this code " Watch "wats the problem in creating mutiple instance for class in this code " New topic
Author

wats the problem in creating mutiple instance for class in this code

krishna balaji
Ranch Hand

Joined: Mar 16, 2006
Posts: 31
In this code both object a and b are not created and its giving unexpected output
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by krishna balaji:
...In this code both object a and b are not created and its giving unexpected output

How are you getting output if neither object is created?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

One likely cause of your troubles is that the member "m" in confserver is static, but it's assigned in the constructor. That means each time you create a confserver, any previous value of m is lost, and all confserver objects share the latest one.

If I may: Java programmers universally use capital letters to name classes; for example "ConfServer". Using all-lowercase class names makes your code exceedingly hard to read for an an experienced programmer.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wats the problem in creating mutiple instance for class in this code
 
Similar Threads
Client and Server Sockets with Threads
Exception in thread "main" java.io.EOFException
y am i getting null pointer exception here?
A j2me program for bandwidth test
socket programin in java