Question: Type the following programs in Java. 3) Array initialization and manipulation Write a program to display on output the content of the following array, myArray;
Type the following programs in Java.
3) Array initialization and manipulation Write a program to display on output the content of the following array, myArray; Array examples: String[] myBouquet - new String[6]; int[] myArray = {7, 24, 352, 2, 37}; 4) Primitive type manipulations and memory usage public class primitive_type{ //The following //datatype stored in memory public static void main(String[] arg){ boolean result = true; char ch = ''; byte b = 100; short 5 - 10000; int = 100000; float fl - 12345f; double dou 12345.555555; Long long1 = new Long(12345L); System.out.println(longi); // Store 1 in bVar. byte bvar - Byte.parseByte("1"); System.out.println(bvar); 1/ Store 2599 in ivar. int ivar - Integer.parseInt("2599"); System.out.println(ivar); // Store 1e in svar. short svar - Short.parseShort("10"); System.out.println(svar); // Store 15988 in lvar. long lvar - Long.parselong("15988"); System.out.println(lvar); // Store 12.3 in fvar. float fvar - Float.parseFloat("12.3"); System.out.println(fvar); 11 Store 7945.6 in dvar. double dvar - Double.parseDouble("7945.6"); System.out.println(dvar); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
