-2
System.out.println("Please enter a coefficients of a polynomial’s terms:");
    String coefficents = keyboard.nextLine();
    String[] three = coefficents.split(" ");
    int[] intArray1 = new int[three.length];

for (int i = 0; i < intArray1.length; i++) {
 System.out.print(intArray1[i]);
}

//Does anyone know how i can make this work because right not it builds but when i run it, it gives me 0

//if someone could show me or explain to me what's wrong that would help

Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247

1 Answers1

0

The problem was that you created the array intArray1 and you printed it without adding any elements to it. That's why it gives 0 as the result. Instead of creating intArray1, print out the array three in the following way:

import java.util.Scanner;

public class test {
    public static void main(String args[]){
        Scanner user_input = new Scanner(System.in);
        System.out.println("Please enter the coefficients of a polynomial’s terms:");
        String coefficents = user_input.nextLine();
        String[] three = coefficents.split(" ");
        for (String i: three) {
            System.out.print(i);
        }
    }
}
stites
  • 4,903
  • 5
  • 32
  • 43
yasith93
  • 16
  • 1