(Extra Credits 4 pts) What is the output of the following program? A byte has a range from -128 to 127, both inclusive. public static void main(String num -= 56; System.out.println(num); // output: }
What is the output of the following Java code? public stat…
What is the output of the following Java code? public static void main(String[] args) { String s1 = “Hello World”; int len = s1.length(); System.out.println(len++);}
(Extra Credits 2 pts) What is the output of the following pr…
(Extra Credits 2 pts) What is the output of the following program? public static void main(String[] args){ String obj = “hello”; String obj1 = “world”; String obj2 = obj; obj2 = “world”; System.out.println(obj + ” ” + obj2);}
(Extra Credits 5 pts) What is the output of the following pr…
(Extra Credits 5 pts) What is the output of the following program? public static void main(String[] args) { int rows = 4; int sum = 0; for(int i = 1; i
What is the output of this block of code? public static void…
What is the output of this block of code? public static void main(String[] args){ int checkThis = 6; switch(checkThis) { case 1: System.out.print(“What “); break; case 3: System.out.print(“we “); break; case 4: System.out.print(“do “); case 5: System.out.print(“in “); case 6: System.out.print(“life “); case 8: System.out.print(“echoes “); case 9: System.out.print(“in “); default: System.out.print(“eternity.”); }}
Predict the output of the following program. public static v…
Predict the output of the following program. public static void main(String System.out.println(var2); // var2: System.out.println(var3); // var3: System.out.println(var4); // var4: System.out.println(var5); // var5:}
Write a method divisors(int n) that returns the number of di…
Write a method divisors(int n) that returns the number of divisors of a positive integer n that is passed into the method. A divisor of an integer n, also called a factor of n, is an integer which divides n without leaving a number. For example, the number 200 has 12 divisors (1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 100, 200). Therefore divisors(200) should return 12. It is easy to test whether a number is a divisor or another number by the modulus operation. For example, 25 is a divisor of 200 because 200 % 25 is equal to 0; 6 is not a divisor of 200 because 200 mod 6 is equal to 2.
This question carries 5 points extra credit. Add the two mis…
This question carries 5 points extra credit. Add the two missing statements/words (–1– and –2–) in the below Java program to ensure, Go Gators! is printed as output. enum Color { RED, BLUE, ORANGE}public class Main { public static void main(String –2–
What is 0b01101011 in decimal: [decimal]? (0b is the prefix…
What is 0b01101011 in decimal: ? (0b is the prefix to indicate 01101011 is a binary number)
What is the output of the following?public static void main(…
What is the output of the following?public static void main(String[] args){ int num1 = 6; int num2 = 36; int num3 = 10; divide(num1, num2); System.out.println(num3);} public static void divide(int num1, int num2){ int num3 = num2 / num1;}