Java. For C through H True or false?
c. Primitive variables must be objects.
d. Integer x; generates a compile time error.
e. Integer y = new Integer(); generates a compile time error.
f. Integer z = new Integer(3); generates a compile time error.
g. Integer u = new Integer(3.14); generates a compile time error.
h. Integer w = new Integer("345"); generates a compile time error.
1.) What is true of classes that can be used with the enhanced for loop? ___
a. All classes can use the enhanced for loop.
b. Only ArrayList can use the enhanced for loop.
c. Only ArrayList and arrays can use the enhanced for loop.
d. Any class that implements Iterable can use the enhanced for loop.
c. Primitive variables must be objects.
False
d. Integer x; generates a compile time error.
False
e. Integer y = new Integer(); generates a compile time error.
True
f. Integer z = new Integer(3); generates a compile time error.
False
g. Integer u = new Integer(3.14); generates a compile time error.
True
h. Integer w = new Integer("345"); generates a compile time error.
False
1)
d. Any class that implements Iterable can use the enhanced for loop.

Java. For C through H True or false? c. Primitive variables must be objects. d. Integer...
I need help answering the following: Why does the following code not compile? List<Integer> intList = new ArrayList<>(); List<Number> numList = intList; a). The types list and ArrayList are different b). Integer is not a subclass of Number. c). List<Integer> is not a subclass of List<Number> d). There is a syntax error. Which of the following statements about Java I/O streams is true? a). I/O streams are only useful for reading to / writing from files on disk b). Character...
1. Suppose you must write a program that performs statistical calculations for a very large set of numerical data. Which would not be the best choices for storing such a collection if performance is important? (select all that apply) Select one or more: A. ArrayList B. LinkedList C. HashMap D. An array of type int or double 2. Which of the following statements is true? Select one: A. The Java map classes can access objects by reference values. B. The...
(This program is to be done on Java) 7.5 ArrayLists Part 1 A significant limitation of the array is you cannot add or delete elements from the array. The size is fixed and you can only do workarounds. An example is the following: public class Ex_7_5_Prep { public static void main(String[] args) { int[] intArray = { 5, 10, 15, 20 }; printArray(intArray); intArray = addNewElement(intArray, 25); printArray(intArray); } public static int[] addNewElement(int[] originalArray, int newInt) { // Create new...
Question 16 You must put your data in classes if you use C++. True False 2 points Question 17 Constructors are automatically invoked during class instantiation. True False 2 points Question 18 To make your data accessible to entities outside of your class, declare the members of that class as private. True False 2 points Question 19 You can make arrays of built-in types like int and double, but not of user-defined types. True False 2 points Question 20 One...
DESCRIPTION: The range of integers that can be represented in Java using a primitive data type is only from-263 to 263-1. What if we need to manipulate integer values beyond this range? In this assignment you will write a HugeInteger class which is able to represent arbitrar- ily large integer numbers. This class must implement arithmetic operations on integers such as addition, subtraction, multiplication, division and comparison. You have to implement this class without using Java predefined classes, unless specified...
Java 1) Final data/code constructs are only inheritable once in java? True or False 2) To access the predecessor in a inheritance chain use the keyword _________? 3) Private constructors can be used for what purpose? Select all that applies. A) Preventing Object instantiation B) Allow interfacing objects to different languages C) Singleton creation D) Allowing only members of your package to instantiate the object
Question 1 Consider the following code snippet: public class Box<E> { private E data; public Box() { . . . } public void insert(E value) { . . . } public E getData() { . . . } } What will result from executing the following code? Box<String> box = new Box<>(); . . . box.insert("blue Box"); String b = box.getData(); A. run-time error B. compiler warning C. no error D. compiler error Question 2 What is used as a...
Please complete the following programming with clear explanations. Thanks! Homework 1 – Programming with Java: What This Assignment Is About? Classes (methods and attributes) • Objects Arrays of Primitive Values Arrays of Objects Recursion for and if Statements Selection Sort Use the following Guidelines: Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc.) Use upper case for constants. • Use title case (first letter is upper case) for classes. Use lower case with uppercase...
Please use Java only: Background: Java contains several different types of interfaces used to organize collections of items. You may already be familiar with the List interface, which is implemented by classes such as the ArrayList. A List represents a collection of elements from which elements can be stored or retreived, in which elements are ordered and can be retrieved by index. A List extends from a Collection, which represents a collection of elements but which may or may not...
1. What is output by the following code: ArrayList< Integer > a = new ArrayList< Integer >(); ArrayList b = a; a.add(new Integer(4)); b.add(new Integer(5)); a.add(new Integer(6)); a.add(new Integer(7)); System.out.println(b.size()); A)1 B)2 C)3 D)4 E)5 2. Assume the Student and Employee classes each extend the Person class. The Student class overrides the getMoney method in the Person class. Consider the following code: Person p1, p2, p3; int m1, m2, m3; p1 = new Person(); m1 = p1.getMoney(); // assignment 1...