Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you explain to me what is going on with this code? Thanks. import java.util.*; public class ArrayDemoObj{ public static void main (String arg [

Can you explain to me what is going on with this code? Thanks.

import java.util.*;

public class ArrayDemoObj{ public static void main (String arg [ ] )throws Exception{ PositiveNumber myArray[ ]= new PositiveNumber[5]; int num = 88; Scanner sc = new Scanner(System.in); for (int i=0; i< myArray.length; i++){ System.out.println(myArray[i]); } System.out.println("**************"); System.out.println("The array length is: "+ myArray.length); sc = new Scanner(System.in); sc.nextLine( ); PositiveNumber pn = new PositiveNumber(num); Arrays.fill(myArray, pn); for (int i=0; i< myArray.length; i++){ System.out.println(myArray[i]); } pn.setNum(45); for (int i=0; i< myArray.length; i++){ System.out.println(myArray[i]); } } }

Can you help me make one? Not really sure how to do it. I just want to know how it works.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions