mira diliprao gaikwad


{ City } pune
< Country > india
* Profession * engineer
User No # 84205
Total Questions Posted # 0
Total Answers Posted # 2

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 2
Users Marked my Answers as Wrong # 1
Questions / { mira diliprao gaikwad }
Questions Answers Category Views Company eMail




Answers / { mira diliprao gaikwad }

Question { RazorSight, 12279 }

How can we find size of the object ?


Answer

public class FindSizeOfObject{
public static void main(String[] args) throws Exception{

Runtime obj = Runtime.getRuntime();
System.out.println(obj.totalMemory() - obj.freeMemory());
}
}

Is This Answer Correct ?    1 Yes 1 No

Question { TCS, 5581 }

How to reduce flicking in animation?


Answer

Double Buffering

sample code of java to reduce flinking :

public void update(Graphics g) {
Graphics offgc;
Image offscreen = null;
Dimension d = size();
offscreen = createImage(d.width, d.height);
offgc = offscreen.getGraphics();
offgc.setColor(getBackground());
offgc.fillRect(0, 0, d.width, d.height);
offgc.setColor(getForeground());
paint(offgc);
g.drawImage(offscreen, 0, 0, this);

}

Is This Answer Correct ?    1 Yes 0 No