Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
An accessor-nó không sửa đổi các chuỗi ban đầu nhưng trả về một chuỗi mới với chữ hoa. 19. box.translate (-5, -10), cung cấp phương pháp được gọi là ngay lập tức sau khi lưu trữ các hình chữ nhật mới vào hộp. 20. x: 30, y: 25 21. Bởi vì phương pháp dịch không thay đổi hình dạng của hình chữ nhật. 22. | Java Concepts 5th Edition 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 2 5 21. Because the translate method doesn t modify the shape of the rectangle. 22. Add the statement import j ava .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 27. Modify the EmptyFrameViewer program as follows 80 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 Chapter 2 Using Objects Page 66 of 67 Java Concepts 5th Edition 33. Line2D.Double segmentl new Line2D.Double 0 0 10 30 g2.draw segment1 Line2D.Double segment2 new Line2D.Double 10 30 20 0 g2.draw segment2 34. g2.drawString V 0 30 35. 0 0 255 36. First fill a big red square then fill a small yellow square inside g2.setColor Color.RED g2.fill new Rectangle 0 0 200 200 g2.setcolor Color.YELLOW g2.fill new Rectangle 50 50 100 100 Chapter 2 Using Objects Page 67 of 67 Java Concepts 5th Edition 81 Chapter 3 Implementing Classes Chapter Goals To become familiar with the process of implementing classes To be able to implement simple methods To understand the purpose and use of constructors To understand how to access instance fields and local variables To appreciate the .