Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***JAVA APPLES*** Code Given (No need to Alter): public final class Apple { private String apple; public Apple() { this.apple = Default whispers of nothing.;

***JAVA APPLES***

Code Given (No need to Alter):

public final class Apple { private String apple; public Apple() { this.apple = "Default whispers of nothing."; } public Apple(String layer) { this.apple = layer; } public final void setApple(String layer) { this.apple = ""; } public final String getApple() { return "Shhh Pineapples"; } public final int getLength() { return this.Apple.length(); } public final String toString() { return this.apple; } }

Class MyApple.java is provided with errors. Fix the code and make it work, Expected output provided if done correctly.

public class MyApple { public static void main(String[] args) { Apple[] theSeeds = new Apple[4]; theSeeds[0] = new Apple("My name is Johnny "); theSeeds[1] = new Apple("Where you from?"); theSeeds[2] = new Apple(); theSeeds[3] = new Apple("Delicious red apples.");

for(int u = 0; u

for(int c = 0; c

Expected to have the following output if all the fixes have been applied to the code:

image text in transcribed

image text in transcribed

The Apple at section 0: My name is Johnny. This Apple sentence is 18 letters long. Listed are the spelling of the sentence: Starting 0 Starting 1 Starting 2 Starting 3 Starting 4 Starting 5 Starting 6 Starting 7 Starting 8 Starting 9 Starting 10 Starting 11 Starting 12 Starting 13 Starting 14 Starting 15 Starting 16 Starting 17 - 03 W3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions