Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What is output? public class Student { private double my GPA; private int myCredits; public void increaseCredits(int amount) { myCredits = my Credits + amount;
What is output? public class Student { private double my GPA; private int myCredits; public void increaseCredits(int amount) { myCredits = my Credits + amount; public void setCredits(int credits) { myCredits = credits; public int getCredits() { return myCredits; public static void main(String [] args) { Student s = new Studento; S.setCredits(6); s.increaseCredits(12); System.out.println(s.getCredits); 18 06 00 O 12 Which is true? public class Car { XXX Person theDriver = new Person; XXX Person getDriver({ XXX should be replaced with private Class Person uses a Car Class Car uses a Person O XXX should be replaced with public Which is true? Class data are normally public A program with multiple classes is contained in a single file A programmer must decide what a class contains and does A programmer should sketch a class while writing the code What is the blueWidget's inStock at the end of main()? public class Widget { private int inStock; public Widget { inStock = 10; public void addInventory(int amt) { inStock = inStock + amt; public static void main(String [] args) { Widget blueWidget = new WidgetO; Widget greenWidget = new WidgetO; blueWidget.addInventory(15); greenWidget.addInventory(5); WW 15 30 10 25 What is the greenWidget's in Stock at the end of main()? public class Widget { private int inStock; public Widget { inStock = 10; public void addInventory(int amt) { inStock = inStock + amt; public static void main(String [] args) { Widget greenWidget = new WidgetO; greenWidget.addInventory(15); greenWidget.addInventory(5); 05 30 10 20 What is the value of honda Accord's odometer at the end of main()? public class SimpleCar { private int odometer; public SimpleCar() { odometer = 0; public SimpleCar(int miles) { odometer = miles; public void drive(int miles) { odometer = odometer + miles; public static void main(String[] args) { SimpleCar fordFusion = new SimpleCarO; SimpleCar hondaAccord = new SimpleCar(30); fordFusion. drive(100); fordFusion, drive(20); 30 20 100 120 How many references are declared? Dog Labrador = new DogO; Dog poodle; Dog beagle = new DogO; poodle = beagle; poodle = labrador; 3 O2 Error: Illegal assignment statement 04 Which XXX assigns the parameter to the instance member? public class Student { private double gpa; public void setGPA(double gpa) { XXX Ogpa=this.gpa; this - gpa double gpa = this.gpa; this.gpagpa; Which replaces "Apples" with "Bananas"? ArrayList groceryList; groceryList = new ArrayListO; groceryList.add("Bread"); groceryList.add("Apples"); groceryList.add("Grape Jelly"); O groceryList.set(2, "Bananas"); O groceryList.replace(1, "Bananas"); O groceryList.replace("Apples","Bananas"); O groceryList.set(1, "Bananas"); What does mystery() do? public class Roster { private ArrayList list; public Student mysteryO{ Student studenti = list.get(0); double gpa = studenti.getGPAO; for(int i = 1; i gpa) { studenti = S; return student1; Returns the student with the lowest GPA Returns the student with the highest GPA Always returns the first student in the roster Sorts the student list by GPA
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