Question: Answer the following about java programming. -------------------------------------------------------- (a) What is the difference between a run-time error and a compile-time error? (b) Which of the two

Answer the following about java programming.

--------------------------------------------------------

(a) What is the difference between a run-time error and a compile-time error? (b) Which of the two is also referred to as a logical error? (c) What is an exception? Give an example. (d) What kind of error can produce an exception?

----------------------------------------------------------- What does the modifier final do to a variable?

---------------------------------------------------------

(a) Explain the difference between a primitive data type and an object data type in Java. (b) List the eight primitive Java data types. ---------------------------------------------------------------------------------

To distinguish between positive and negative numbers using binary digits, a 0 is added to the beginning of the string if the decimal number it represents is positive while 1 is added if the number is negative. For example, using 5-bit strings to represent 12 and 12 respectively, we would see (12)10 = (01100)2 while ( 12)10 = (11100)2. Under this convention, explain why the largest number a byte can store is 127.

--------------------------------------------------------------

You are given two tasks. Task 1 requires that you store a list of 50 phone numbers, while Task 2 requires that you store a list of names of visitors to a hospital. Explain whether you would use an array or an array list to complete each task.

-----------------------------------------------------------------------------------

Consider the following lines of code:

package kapiva; public class PrimitiveVsObject { public static void main(String[] args) { int[] ages = {1, 2, 3, 4, 5, 2}; int numChildren = ages.length; System.out.println("There are " + numChildren+" children in the daycare center today."); System.out.println("Here are their ages: "+ages); } } OUPUT: There are 6 children in the daycare center today. Here are their ages: [I@15db9742 (a) (Explain why the expected output is printed for numChildren but not for ages. (b) What is printing for the object name ages?

-------------------------------------------------------

(a) What is a reference? (b) What does it mean to pass data to a method by value? (c) What does it mean to pass data to a method by reference?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!