Ask Questions & Get Answers at ibibo sawaal

Dan Dan's Questions & Answers

122

Rank

7597

2954

274

84

What are peer "classes"?

Asked by Vidya Rani in Computers & Technology at   12:22 PM on November 11, 2008

Dan Dan's Answer

The purpose of the abstract Peer class is to provide a common base class definition that can be shared by derived classes such as PeerNearMe and PeerContact. It cannot be directly constructed, since it is abstract. Developers should use the subclasses PeerNearMe or PeerContact instead.

Contact, peer, remote peer, PeerNearMe, LocalContact, and PeerContact are synonymous terms, based on context.

"Calling peer" and "remote peer" are commonly synonymous. Calling peer does not refer to the application calling a given method.

Answered at 12:36 PM on November 11, 2008

Read all answers

Does Java pass method arguments by value or by reference?

Asked by Vidya Rani in Computers & Technology at   12:31 PM on November 11, 2008

Dan Dan's Answer

Your question demonstrates a common error made by Java language newcomers. Indeed, even seasoned veterans find it difficult to keep the terms straight.

Java does manipulate objects by reference, and all object variables are references. However, Java doesn't pass method arguments by reference; it passes them by value.

Take the badSwap() method for example:
public void badSwap(int var1, int var2)
{
int temp = var1;
var1 = var2;
var2 = temp;
}



When badSwap() returns, the variables passed as arguments will still hold their original values. The method will also fail if we change the arguments type from int to Object, since Java passes object references by value as well. Now, here is where it gets tricky:
public void tricky(Point arg1, Point arg2)
{
arg1.x = 100;
arg1.y = 100;
Point temp = arg1;
arg1 = arg2;
arg2 = temp;
}
public static void main(String [] args)
{
Point pnt1 = new Point(0,0);
Point pnt2 = new Point(0,0);
System.out.println("X: " + pnt1.x + " Y: " +pnt1.y);
System.out.println("X: " + pnt2.x + " Y: " +pnt2.y);
System.out.println(" ");
tricky(pnt1,pnt2);
System.out.println("X: " + pnt1.x + " Y:" + pnt1.y);
System.out.println("X: " + pnt2.x + " Y: " +pnt2.y);
}

If we execute this main() method, we see the following output:
X: 0 Y: 0
X: 0 Y: 0
X: 100 Y: 100
X: 0 Y: 0

Answered at 12:34 PM on November 11, 2008

Read all answers

Can you explain CLASSPATH?

Asked by Vidya Rani in Computers & Technology at   11:56 AM on November 11, 2008

Dan Dan's Answer

The Classpath is an argument set on the command-line, or through an environment variable, that tells the Java Virtual Machine where to look for user-defined classes and packages in Java programs.

Answered at 11:59 AM on November 11, 2008

Read all answers

How does garbage collection work?

Asked by Vidya Rani in Computers & Technology at   12:31 PM on November 11, 2008

Dan Dan's Answer

Your question demonstrates a common error made by Java language newcomers. Indeed, even seasoned veterans find it difficult to keep the terms straight.

Java does manipulate objects by reference, and all object variables are references. However, Java doesn't pass method arguments by reference; it passes them by value.

Take the badSwap() method for example:
public void badSwap(int var1, int var2)
{
int temp = var1;
var1 = var2;
var2 = temp;
}
When badSwap() returns, the variables passed as arguments will still hold their original values. The method will also fail if we change the arguments type from int to Object, since Java passes object references by value as well. Now, here is where it gets tricky:
public void tricky(Point arg1, Point arg2)
{
arg1.x = 100;
arg1.y = 100;
Point temp = arg1;
arg1 = arg2;
arg2 = temp;
}
public static void main(String [] args)
{
Point pnt1 = new Point(0,0);
Point pnt2 = new Point(0,0);
System.out.println("X: " + pnt1.x + " Y: " +pnt1.y);
System.out.println("X: " + pnt2.x + " Y: " +pnt2.y);
System.out.println(" ");
tricky(pnt1,pnt2);
System.out.println("X: " + pnt1.x + " Y:" + pnt1.y);
System.out.println("X: " + pnt2.x + " Y: " +pnt2.y);
}

Answered at 12:33 PM on November 11, 2008

Read all answers

How Can I Avoid Flicker in an Applet?

Asked by Vidya Rani in Computers & Technology at   11:56 AM on November 11, 2008

Dan Dan's Answer

The key to fixing flicker is realizing that the screen isn't actually painted in the paint() method. The pixels get put on the screen in the update() method which most applets don't override. However by overriding the update() method you can do all your painting in an offscreen Image and then just copy the final Image onto the screen with no visible flicker. The cookbook approach is simple. Add the following three private fields to your applet and the public update() method. Flicker will magically disappear.

private Image offScreenImage;
private Dimension offScreenSize;
private Graphics offScreenGraphics;
public final synchronized void (Graphics g){
Dimension d = size();
if((offScreenImage == null) ||(d.width !offScreenSize.width)||
(d.height !=offScreenSize.height))
{
offS creenImage = createImage(d.width,d.height);
of fScreenSize = d;
offScreenGraphics = offScreenImage.getGraphics();
}
offScreenGraphics.clearRect(0,0,d. width,
d.height);
paint(offScre enGraphics);
g.drawImage(offScree nImage,0,0,null);
}

Answered at 11:58 AM on November 11, 2008

Read all answers

Netscape gives me "Applet Not Initialized Error"?

Asked by Vidya Rani in Computers & Technology at   11:54 AM on November 11, 2008

Dan Dan's Answer

This is almost always means Netscape can't find one of the classes it needs to run the applet. Check to make sure that the classes your program uses are in the CODEBASE, the CLASSPATH, or somewhere else Netscape can find them. It's not uncommon to get this error when you first test a new package or class you've written with Netscape. If you've only tested it with the applet viewer or an IDE, then the applet viewer or the IDE may have included the current directory in the CLASSPATH where Netscape does not. Therefore the applet viewer can find the right class, but Netscape can't. Explicitly add the path containing your class or package to the CLASSPATH as specified in the previous question.

Answered at 12:01 PM on November 11, 2008

Read all answers

Advantage and disadvantage of waterfall model of software engg?

Asked by gilli ... in Computers & Technology at   10:29 AM on November 10, 2008

Dan Dan's Answer

WaterFall Model advantages:
It is a linear sequestial model
It is very simple model to implement
It is the first model.
It needs very few resources to implement
Disadvantages:
In this model there is no back tracking.
For example if any error occured an any
stage of software development,it cann't be
corrected in that build.

Answered at 1:05 PM on November 10, 2008

Read all answers

How do you colour your name in call of duty 2?

Asked by gilli ... in Computers & Technology at   10:25 AM on November 10, 2008

Dan Dan's Answer

Press the tilde key (~) while already in Call of Duty 1 or 2 Multiplayer.
Type /name into the rectangle which will appear, called the Console.
Hold down shift and press the six key, to produce ^.
Press a number for a color.
Type your name in, using the coloring in which you have chosen throughout the name.
Press enter when you are finished, and you will see that your name has changed in game (if you are already in a game; If not, then it will have applied, but you will not be able to see so unless you check your Multiplayer Settings.)
Press the tilde key (~) again, to close the console and resume your gameplay.

Answered at 1:08 PM on November 10, 2008

Read all answers

Difference between Network OS and Distributed OS?

Asked by gilli ... in Computers & Technology at   10:25 AM on November 10, 2008

Dan Dan's Answer

I think a distributed operating system is one where all of computers that are connected can share in tasks that need to be done. So you could have one or more programs that you are using that are actually running on someone else's computer. This way your computer is not bogged down by trying to do everything itself.

A network operating system is used to describe a set up where computers are connected and can share some resources either with each other, or a central server. They generally don't openly share all of the workload, although the server can and does provide many services for the other computers on the network.

Answered at 1:07 PM on November 10, 2008

Read all answers

Witch is best PC Con fig for 3D Games as well multimedia. Please send me friends?

Asked by kishore in Computers & Technology at   12:00 PM on November 10, 2008

Dan Dan's Answer

If you want to play all the latest games and future games too then this is the best config you can have in minimum budget.

CPU: Intel Core 2 Duo e7200 2.53 ghz- Rs.5200

RAM: 2 GB system memory - Transcend-Rs.1700/ G-skill-Rs.2200(I Recommend)

GRAPHICS Card: Palit ATI HD4850-512MB -Rs.8600

Answered at 1:13 PM on November 10, 2008

Read all answers

Editor's Pick

Categories

sawaal signature
sawaal free visiting card