Question: please help me with this java programming past paper 1. Primitive Data Types and Control Statements (a) List Java's eight primitive types, along with the

please help me with this java programming past paper
 please help me with this java programming past paper 1. Primitive

1. Primitive Data Types and Control Statements (a) List Java's eight primitive types, along with the range of each of the integer types. [3] (b) Java can convert variables between various types. i. Explain, with examples, the difference between an implicit typecast and an ex plicit typecast ii. Given the following code, what will the output be and why? 13] public static void main (String args[) short a3450; byte b (byte) a; System.out.println (b); (c) Program control in Java can be managed using if and switch statements. Rewrite the following code in the most concise form possible using a switch statement. [5] Scanner sinput new Scanner (System.in); int c- sinput.nextInt o; if (c == -1) system . out.println("Exiting application"); else if (c0) System.out.println ( "Please enter a number between 1 and 3") else if (c1) System.out.println ("Entering mode 1") else if c2) System.out.println ("Entering mode 2") else if c3) System.out.println ("Entering mode 3") else System.out.println ( "Please enter a number between 1 and 3") (d) Given the following code, if (a1) if (b3) System.out.println("A is 1 and B is 3" else System.out.println("A is not 1"); i. What will the output be, and why? ii. Rewrite the code using a single i f statement, and fix any semantic errors. 3] 12]

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!