Ask Questions & Get Answers at ibibo sawaal

9

Rank

58673

14500

5

24

How are the elements of a BorderLayout organized?

Asked by L Prasad in Computers & Accessories at   7:45 AM on February 03, 2009

Yuvee's Answer

The elements of a BorderLayout are organized at the borders (North, South, East, andWest) and the center of a container.

Answered at 7:53 AM on February 03, 2009

Read answer

Which containers may have a MenuBar?

Asked by L Prasad in Computers & Accessories at   7:45 AM on February 03, 2009

Yuvee's Answer

Frame.

Answered at 7:53 AM on February 03, 2009

Read answer

How are this() and super() used with constructors?

Asked by L Prasad in Computers & Accessories at   7:46 AM on February 03, 2009

Yuvee's Answer

this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.

From within a constructor, you can also use the this keyword to call another constructor in the same class. Doing so is called an explicit constructor invocation. Here's another Rectangle class, with a different implementation from the one in the Objects section.
public class Rectangle {
private int x, y;
private int width, height;

public Rectangle() {
this(0, 0, 0, 0);
}
public Rectangle(int width, int height) {
this(0, 0, width, height);
}
public Rectangle(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
...
}
This class contains a set of constructors. Each constructor initializes some or all of the rectangle's member variables. The constructors provide a default value for any member variable whose initial value is not provided by an argument. For example, the no-argument constructor calls the four-argument constructor with four 0 values and the two-argument constructor calls the four-argument constructor with two 0 values. As before, the compiler determines which constructor to call, based on the number and the type of arguments.
If present, the invocation of another constructor must be the first line in the constructor.


Super()


With super(), the superclass no-argument constructor is called. With super(parameter list), the superclass constructor with a matching parameter list is called.

This could be a problem, if there is a constructor in the superclass that does a lot of necessary work. It looks like you might have to repeat all that work in the subclass! This could be a real problem if you don't have the source code to the superclass, and don't know how it works, or if the constructor in the superclass initializes private member variables that you don't even have access to in the subclass!

Obviously, there has to be some fix for this, and there is. It involves the special variable, super(). As the very first statement in a constructor, you can use super to call a constructor from the superclass.

Answered at 7:53 AM on February 03, 2009

Read answer

What is an object's lock and which object's have locks?

Asked by L Prasad in Computers & Accessories at   7:46 AM on February 03, 2009

Yuvee's Answer

An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock isacquired on the class's Class object.

Answered at 7:53 AM on February 03, 2009

Read answer

How to communicate 2 threads each other?

Asked by L Prasad in Computers & Accessories at   7:46 AM on February 03, 2009

Yuvee's Answer

Thread:It is a lightweight program.or seperate execution path in the program.
Normally threads are communicated using the following methods.
1.notify();
2.notifyAll( );
and
3.yield();

Answered at 7:52 AM on February 03, 2009

Read answer

Which containers use a border Layout as their default layout?

Asked by L Prasad in Computers & Accessories at   7:46 AM on February 03, 2009

Yuvee's Answer

The window, Frame and Dialog classes use a border layout as their default layout.

Answered at 7:52 AM on February 03, 2009

Read answer

What is the difference between Iterator and Enumeration?

Asked by L Prasad in Computers & Accessories at   7:47 AM on February 03, 2009

Yuvee's Answer

Enumeration and Iterator both are interfaces present in util package. Enumeration is a legacy interface which does not come under the collection framework, wheras Iterator is an interface present in the collection framework. All the legacy classes like Stack, Vector , Hashtable, Properties can use Enumeration for enumerating the elements from the collection. The classes under the collection framework like ArrayList, LinkedList, HashSet ,Tree Set etc can use the Iterator interface.

Iterator actually adds one method that Enumeration doesn't has: remove().

Answered at 7:52 AM on February 03, 2009

Read answer

How will you communicate between two Applets?

Asked by L Prasad in Computers & Accessories at   7:46 AM on February 03, 2009

Yuvee's Answer

Applet Communication:By using AppletContext() we can communicate in two applets.
_______________________

Answered at 7:52 AM on February 03, 2009

Read answer

What is the % operator?

Asked by L Prasad in Computers & Accessories at   7:47 AM on February 03, 2009

Yuvee's Answer

It is referred to as the modulo or remainder operator. It returns the remainder of dividing the first operand by the second operand.

Answered at 7:52 AM on February 03, 2009

Read answer

What is the Set interface?

Asked by L Prasad in Computers & Accessories at   7:46 AM on February 03, 2009

Yuvee's Answer

The Set interface provides methods for accessing the elements of a finite mathematicalset. Sets do notallow duplicate elements.

Answered at 7:52 AM on February 03, 2009

Read answer

Editor's Pick

Categories

sawaal signature
sawaal free visiting card