Đang chuẩn bị liên kết để tải về tài liệu:
Thinking in Java 4th Edition phần 8

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Nếu bạn xem xét rằng có khoảng 262 phân số khác nhau hai lần giữa o và 1, khả năng vươn tới bất kỳ một giá trị thực nghiệm có thể vượt quá tuổi thọ của một máy tính, hoặc thậm chí một trong thí nghiệm. Nó chỉ ra rằng 0,0 là bao gồm trong đầu ra của Math.random (). Hoặc, trong ngôn ngữ toán học, nó là 0,1). | Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com import net.mindview.util. public enum Course APPETIZER Food.Appetizer.class MAINCOURsE Food.MainCourse.class DESSERT Food.Dessert.class COFFEE Food.Coffee.class private Food values private Course Class extends Food kind values kind.getEnumConstants public Food randomSelection return Enums.random values Each of the above enums takes the corresponding Class object as a constructor argument from which it can extract and store all the enum instances using getEnumConstants . These instances are later used in randomSelection so now we can create a randomly generated meal by selecting one Food item from each Course enumerated menu Meal.java package enumerated.menu public class Meal public static void main String args for int i 0 i 5 i for Course course Course.values Food food course.randomSelection System.out.println food System.out.println --- . . Output Spring_rOlls VINDALOO FRUIT DECAF_COFFEE SOUP VINDALOO FRUIT TEA SALAD BURRITO FRUIT TEA SALAD BURRITO CREME_CARAMEL LATTE SOUP BURRITO TIRAMISU ESPRESSO Enumerated Types 735 Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com In this case the value of creating an enum of enums is to iterate through each Course. Later in the VendingMachine.java example you ll see another approach to categorization which is dictated by different constraints. Another more compact approach to the problem of categorization is to nest enums within enums like this enumerated SecurityCategory.java More succinct subcategorization of enums. import net.mindview.util. enum SecurityCategory STOCK Security.Stock.class BOND Security.Bond.class Security values SecurityCategory Class extends Security kind values kind.getEnumConstants interface Security enum Stock implements Security SHORT LONG MARGIN enum Bond implements Security MUNICIPAL JUNK public Security randomSelection return Enums.random values public static void main String args for int i 0 i 10 i .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.