Can someone explain me what is the use of super.paint(g)
where, g
is a Graphics
variable in Applets or awt or swings or in Java.
I have done research and found that it is used to override but what is the use of this override?
I am a beginner. If possible can you explain the difference between paint(g)
and super.paint(g)
with a small example
or please help me with this code?
/*
Let us consider this code
This has only one paint declaration i.e; subclass's paint method declaration, no declaration for superclass's paint function... when we explicitly call superclass's paint function
what is the use of super.paint(g) and is it going to use superclass's paint declaration??
*/
import java.awt.*;
import java.applet.*;
/*
<applet code="superpaintDemo" height=768 width=1366>
</applet>
*/
class superpaintDemo extends Applet
{
public void paint(Graphics g)
{
super.paint(g);
g.drawString("This is Demo",200,200);
}
}