Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can Applet have constructors?

Answers were Sorted based on User's Feedback



Can Applet have constructors?..

Answer / rohit chhabra

usualy applets hv no contructors coz we do't need to create
object of the applet class...
but if one wants to create an object of an applet class,
create it in static block...This block execute before init
method..

Is This Answer Correct ?    45 Yes 4 No

Can Applet have constructors?..

Answer / sunil dhadwe

In Java, every class has constructor, so Applet class also has constructor which is invoked when Applet object is created by browser or Applet Viewer. Usually we don't need constructor as we don't create Applet object.
To write applet we write our own class that extends Applet, so our class also becomes Applet. Our class can also have constructor. From our class we can call super class (Applet) constructor. Look at following code:
import java.applet.Applet;
import java.awt.Graphics;

/*
<applet code="AppletConst" width=400 height=300>
</applet>
*/

public class AppletConst extends Applet {

public AppletConst() {
super(); // no compilation error : means Applet class has constructor
System.out.println("Applet constructor");
}

public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25);
}
}

Is This Answer Correct ?    39 Yes 3 No

Can Applet have constructors?..

Answer / urusa

Applets do not have constructors because we don't need to create the object of the applet class....so its justified that it is true that applets usually do not have constructors

Is This Answer Correct ?    12 Yes 3 No

Can Applet have constructors?..

Answer / roy antony arnold

Don't say like this....

Answer:
Applets don't usually have constructors because an applet
isn't guaranteed to have a full environment until its
init() method is called. For example, the Applet image
loading methods don't work inside an applet constructor, but
can be called from the init() method.

Is This Answer Correct ?    12 Yes 8 No

Can Applet have constructors?..

Answer / therathna

In Java For Every Class we can provide constructors so
o busily we can provide constructors for applets.


u Don't ask like this type of questions because we can
pratically found these questions when done programs

u ask only questions like which are not practically unable
to do

Is This Answer Correct ?    5 Yes 23 No

Post New Answer

More Core Java Interview Questions

What modifiers are used for interface declaration?

7 Answers  


How to convert string to byte array and vice versa?

0 Answers  


Need to use public,static keywords in main function?

5 Answers  


What are event-delegation model and event-inheritance model? Which is best?

1 Answers  


What is collection class in java? List down its methods and interfaces.

0 Answers  


What is the difference between notify and notifyall method?

0 Answers  


What is access modifiers?

1 Answers   Cap Gemini,


Why set do not allow duplicates in java?

0 Answers  


Difference between the paint() and repaint() methods?

1 Answers  


how to transactions(Bank transactions) in business process in ejb?

1 Answers   Photon,


What is the purpose of an interface?

0 Answers  


What is a conditional statement explain with example?

0 Answers  


Categories