Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How many fields are declared in the Car class? public class Car { // declare private fields public void drive(int miles) {}; public void addGas
How many fields are declared in the Car class? public class Car { // declare private fields public void drive(int miles) {}; public void addGas (double gallons) {}; public int checkOdometer {}; 03 00 Unknown 2. How many objects of type Car are created? Car mustang = new CarO; Car prius; int miles; Truck tundra = new TruckO; 2 03 1 oo What is copied Nums' length after the code segment? int[] original Nums = {1,2,3,4,5}; int[] copiedNums; copy(originalNums, 3); public static int[] copy(int[] nums, int change Amt) { int[] modifiedNums = new int[nums.length * changeAmt]; int index; for(index = 0; index 0) { --listSize; return listSize; shoppingList[i] = shoppingList[i-1]; shoppingList[i+1] = shoppingList[i]; shoppingList[i] = shoppingList[i+1]; --shoppingList[i]; What is output? public static void replace(int [] allGrades, int examScore) { allGrades[1] = examScore; public static void main(String args[]) { int[] myGrades = {72,84,75,92,65}; replace(myGrades, 100); System.out.print(myGrades[1]); 84 error 100 72 What is the output when calling printName("Juan", 19)? public static void printName(String name, int id) { System.out.print(name + " ID: " + id); public static void printName(int id) { System.out.print("Name" + " ID: " + id); public static void printName(String name, int id, int age) { System.out.print(name + " ID:" + id + " age: " + age); Name ID: 19 There is no output Juan ID: 19 Juan ID: 19 age: 19 What is the output? public static void swapValues(int x, int y) { int tmp; tmp = x; X = y; y = tmp; public static void main(String args[]) { int p = 4, 9 = 3; swapValues(p, q); System.out.print("p = " + P + ", 9 = " + 9); Error: Argument names must match parameter names Op=4,-3 O p = 3,9-3 O p = 3,9-4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started