Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the above program both label object and drawString method displays the same s

ID: 3539518 • Letter: I

Question

In the above program both label object and drawString method displays the same string After.
Because they are displayed at the same cooridinates 50, 50 and as the string is the same, one overlaps the other so that only one After is displayed.
a) True b) False

- See more at: http://way2java.com/java-questions/test-your-java-8/#sthash.sKVeFGKc.dpuf

  import java.awt.* ;        class Coincidence extends Frame       {          Coincidence()            {            Label label = new Label("After");              setLayout(null);            label.setBounds(50, 50, 50, 50);                     add(label);          }          public void paint(Graphics g)            {            g.drawString("After", 50, 50);          }          public static void main(String args[])           {            Frame f = new Coincidence();             f.setVisible(true);              f.setSize(300, 300);          }        }

Explanation / Answer

False


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote