Java Reference
In-Depth Information
17. 0
18. An accessorȌit doesn't modify the original string but returns a new string
with uppercase letters.
19. box.translate(Ċ5, Ċ10) , provided the method is called
immediately after storing the new rectangle into box .
20. x: 30, y: 25
21. Because the translate method doesn't modify the shape of the rectangle.
22. Add the statement import java.util.Random ; at the top of your
program.
23. toLowerCase
24. ÐHello, Space !Ñ Ȍonly the leading and trailing spaces are trimmed.
25. Now greeting and greeting2 both refer to the same String object.
26. Both variables still refer to the same string, and the string has not been
modified. Recall that the toUpperCase method constructs a new string
that contains uppercase characters, leaving the original string unchanged.
79
80
27. Modify the EmptyFrameViewer program as follows:
frame.setSize(300, 300);
frame.setTitle(ÐHello, World!Ñ);
28. Construct two JFrame objects, set each of their sizes, and call
setVisible(true) on each of them.
29. Rectangle box = new Rectangle(5, 10, 20, 20) ;
30. Replace the call to box.translate(15, 25) with
box = new Rectangle(20, 35, 20, 20);
31. The compiler complains that g doesn't have a draw method.
32. g2.draw(new Ellipse2D.Double(75, 75, 50, 50)) ;
Search WWH ::




Custom Search