Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this code, when you run it you will get this (I'm running it on Eclipse IDE) 11 ---------- bob tom jane

I need help with this code, when you run it you will get this (I'm running it on Eclipse IDE)

"11 ---------- bob tom jane jojo angus susan lucy sam rosebud phill debbie pat george Hello"

I need to know how to get rid of the space after the name "george" and also the "11" and "----------" above the name list. Thank you

package edu.mccc.cos210.al;

import java.util.stream.IntStream;

public class ArrayLecture {

public static void main(String[] args) { new ArrayLecture().doIt(); }

private void doIt() { int[] na = new int[11]; System.out.println(na.length); for (int i = 0; i < na.length; i++) { na[i] = i * i; } for (int i = 0; i < na.length; i++) { // System.out.println(na[i]); } System.out.println("----------"); // IntStream.range(0, 11).map(n -> n * n).forEach(System.out::println); double[] da = new double [17]; for (int i = 0; i < da.length; i++) { da[i] = Math.pow(2.0, Double.valueOf(i)); } for (int i = 0; i < da.length; i++) { // System.out.printf("%.0f ", da[i]); } // IntStream.range(0, 17) // .mapToObj(n -> Math.pow(2.0, Double.valueOf(n))) // .map(Double::intValue) // .forEach(System.out::println) // ; String[][] saa = { new String[] { "bob", "tom", "jane","jojo"}, new String[] { "angus", "susan",}, new String[] { "lucy", "sam", "rosebud",}, new String[] { "phill", "debbie", "pat", "geoger", }, }; // System.out.println(saa.length); for (int i = 0; i < saa.length; i++) { // System.out.println(saa[i].length); } // System.out.println(saa[2][1]); for (int i = 0; i < saa.length; i++) { for (int j = 0; j < saa[i].length; j++) { if (!(i == saa.length && j == 3)) { System.out.print(saa[i][j] +" "); } else { System.out.println(saa[i][j]); } } } System.out.println(); System.out.println("Hello"); } }

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago