Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Explain the difference in Java between int and Integer. 2. Write a line of Java code to... a) Declare an ArrayList of floating point

image text in transcribed
image text in transcribed
image text in transcribed
1. Explain the difference in Java between int and Integer.
2. Write a line of Java code to...
a) Declare an ArrayList of floating point numbers (doubles).
b) Generate a random double in the interval and add it to the ArrayList you created in A.
3. Consider the following Java declarations:
ArrayList list = new ArrayList();
ArrayList x = new ArrayList();
Integer one = new Integer(1);
int two = 2;
Determine whether each line below would COMPILE or cause a COMPILE-TIME ERROR. Briefly explain your reasoning.
a) list.add( two );
b) list.add( one );
c) list.add( one );
d) x.add( one );
e) x.add( two );
f) x.add( one.toString() );
g) x.add( two.toString() );
Consider the follown Jove declaration Raya Determine where we COUPLE COMPLETE ERROR Bryan you remong ste .. AN CITI D. E on the Saat beberaber the flowing System.out.print By 7 What is the won the wees E 3. Consider the following Java declarations ArrayListinte stw Arenger ArrayListing new ArrayListing Integer one new Integer int two 21 Determine whether each line below would COMPILE or cause a COMPILE-TIME ERROR Briefly explain your reasoning *) list.add to b) list.addio c) Int.add(0); d) .add coe E) x add one.tostring) 91 *.add two.test) 11 4. Which of the follis equivalent to the expression> A > DIL > BIL > Max DI > max C DLC max 1 > D. b c 1 DERI E. None of the above 5. Let dog and cat be booles variables the expression dog cat which of the folowing must also be ? I do t cat I do at Al only only Candil only D. Il and only E. None of Use the code below tower questions 6-7 SERING ou abra", "try 6. What is the output when the following statement is executed? System.out.printl. vetting to bring A logo B. alcantry Calcmetry Dalculatay Elutty 7. What is the output when the following code is executed? 32 1. Explain the difference in Java between int and Integer. 2. Write a line of Java code to... a) Declare an ArrayList of floating point numbers (doubles). b) Generate a random double in the interval and add it to the ArrayList you created in (a). 3. Consider the following Java declarations: ArrayList list - new ArrayList(); ArrayList x = new ArrayList(); Integer one - new Integer (1) int two = 2; Determine whether each line below would COMPILE or cause a COMPILE-TIME ERROR. Briefly explain your reasoning. a) list.add( two ); b) list.add( one ): c) list.add("one" ); d) x.add( one) e) x.add( two); f) x.add( one.toString() ); g) x.add( two.toString())

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

What are an input-output matrix and a consumer-demand matrix?

Answered: 1 week ago

Question

=+4 Develop and deliver the CCT program.

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago