Question: 1. What is the proper way to utilize the enum declared below? Select the one correct answer. public enum Suit { HEARTS, CLUBS, SPADES, DIAMONDS
1. What is the proper way to utilize the enum declared below? Select the one correct answer. public enum Suit { HEARTS, CLUBS, SPADES, DIAMONDS }
A. Suit suit = Suit.HEARTS;
B. int suit = Suit.CLUBS;
C. String suit = Suit.SPADES;
D. None of the above
2.Given the following class, which of these are valid ways of referring to the class from outside of the package net.basemaster? Select the two correct answers. package net.basemaster; public class Base { // class stuff here }
| A. By simply referring to the class as Base | ||||||||||||||||||
| B. By simply referring to the class as basemaster.Base | ||||||||||||||||||
| C. By simply referring to the class as net.basemaster.Base | ||||||||||||||||||
| D. By importing with net.basemaster.* and referring to the class as Base | ||||||||||||||||||
| E. By importing with net.* and referring to the class as basemaster.Base 3.Which is the correct order that the class, package, and import statements should appear? Select the one correct answer.
4.Given the following code, what is the result when run? Select the one correct answer. public class Program { public static void main(String args [] ) {!@ short x = 2; x++;## short y = 3 + x++; System.out.print(y); } }
5.Given the following definition of a class, which fields are accessible from outside the package com.corporation.project? Select the two correct answers. package com.corporation.project; public class MyClass { int i; public int j; protected int k; private int el; }
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
